Why don't built-in commands use UIFactory?

Asked by EdB

Hi everyone,

I've been working on a wrapper library for Bazaar so it can be called from C, C++ or C# (or any dot-net language), which I plan to push up to Launchpad when it's working reasonably. I've got some of it working, including the ability to call built-in commands such as cmd_branch or cmd_commit. I have my own UIFactory which calls a Python object I built in a Python extension DLL that passes all of the UI callbacks to a function pointer, that can be set to your own class, so you can for example map get_boolean with a call to Windows MessageBox with YES/NO buttons, or the command line, or anything you wanted.

The problem is when I run some commands, for example cmd_uncommit, they don't do their UI via the UIFactory. They use print and raw_input and so forth, so I can't override them and do a GUI. My only way around it would be to duplicate the command using UIFactory for output, or else not use the command with my GUI as cmd_uncommit would just hang on raw_input not running in a console application (stdout ignored, stdin unreachable).

Is this by design? Is there any reason some commands don't use the UIFactory? Is there a plan to change this? Any recommendations?

Thanks much!

-Ed

Question information

Language:
English Edit question
Status:
Solved
For:
Bazaar Edit question
Assignee:
No assignee Edit question
Solved by:
Martin Pool
Solved:
Last query:
Last reply:
Revision history for this message
Best Martin Pool (mbp) said :
#1

Hi Ed,

Those commands are just out of date. We want to change them to do all
user interaction through uifactory, precisely so that we can do the
kind of thing you describe, and so that the user interaction is more
consistent. Patches to fix commands to do this are very welcome: I
suggest you start by fixing just one command or one bit, and proposing
a merge of that, so we can give you some feedback.

hth
--
Martin <http://launchpad.net/~mbp/>

Revision history for this message
EdB (ed-marsfire) said :
#2

Thanks Martin Pool, that solved my question.

Revision history for this message
EdB (ed-marsfire) said :
#3

I will have cmd_uncommit converted soon. How does one propose a merge?

Revision history for this message
EdB (ed-marsfire) said :
#4

OK, I see, I need to get a launchpad account and there's a process for it. I will try it, since I have the cmd_uncommit working with a UIFactory now.

Revision history for this message
EdB (ed-marsfire) said :
#5

OK, merge proposed!