pombreda / dicompyler

Automatically exported from code.google.com/p/dicompyler
0 stars 0 forks source link

Textbox in preferences #79

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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

Original issue reported on code.google.com by jakob.to...@gmail.com on 3 Sep 2012 at 9:08

GoogleCodeExporter commented 9 years ago
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.

Original comment by bastula on 5 Sep 2012 at 1:49