Issue 79 in dicompyler: Textbox in preferences

5 views
Skip to first unread message

dicom...@googlecode.com

unread,
Sep 3, 2012, 5:08:50 AM9/3/12
to dicompyle...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 79 by jakob.to...@gmail.com: Textbox in preferences
http://code.google.com/p/dicompyler/issues/detail?id=79

Hi

I'm writing a plugin which has to connect to an external server, in that
context I need login information from the user, to help me and the user I
want to store the login information in preferences. To do that I need a
text input field in preferences, but I can't find it, is it implemented and
me who just can't find it?

Furthermore I have two suggestions for some features that our group will
find helpful.

A) A kind of hook for plugins to the left notebook panel or a way that
the 'main' plugin can add a extra panel,

B) An export to image function either a function which creates
a "screenshot" of the active main window or a function that ask the plugin
for image data or a mix

By the way thanks for an easy to use and extends program



dicom...@googlecode.com

unread,
Sep 5, 2012, 9:50:01 AM9/5/12
to dicompyle...@googlegroups.com
Updates:
Status: Accepted
Owner: bastula
Labels: -Type-Defect Type-Enhancement

Comment #1 on issue 79 by bastula: Textbox in preferences
http://code.google.com/p/dicompyler/issues/detail?id=79

Hi Jakob,

Thanks for the suggestions. The features you mentioned are features that I
have considered implementing before, but I haven't had any time to work on
them.

I have just used screen capture programs in the past since that has been
sufficient. You could write a function to save the active panel/window to
disk via a DC using wxPython, if you wanted to do it programmatically.

Regarding your first question, there is currently no preference setting for
a text input field. However you can save and retrieve arbitrary data to the
preferences file, using your own GUI (maybe create your own dialog?).

For example:

In dicomgui.py, the last directory that was used to browse is saved to
preferences via:

pub.sendMessage('preferences.updated.value',
{'general.dicom.import_location':self.path})

where the setting name is called 'general.dicom.import_location' and the
value is self.path.

The value is retrieved by binding a function to the pub.subscribe event,
then requesting the values for the 'dicom' settings as follows:

# Initialize the import location via pubsub
pub.subscribe(self.OnImportPrefsChange, 'general.dicom')
pub.sendMessage('preferences.requested.values', 'general.dicom')

def OnImportPrefsChange(self, msg):
"""When the import preferences change, update the values."""

if (msg.topic[2] == 'import_location'):
self.path = unicode(msg.data)

That's how I've done it before for my own custom plugins.

Hope that helps.

Reply all
Reply to author
Forward
0 new messages