Discussion:
[referencer] Fwd: Referencer Plugin: Configuration Dialog
John Spray
2010-06-22 13:54:45 UTC
Permalink
---------- Forwarded message ----------
From: Matej Urbas <matej.urbas at gmail.com>
Date: Tue, Jun 22, 2010 at 1:06 AM
Subject: Referencer Plugin: Configuration Dialog
To: jcspray at icculus.org


Hi!

Could I please ask you for advice on how to display a configuration
dialog for a python plugin in Referencer?

This is my current code (excerpt from file 'ReferencerNotes.py'), which
works as a standalone application but not if invoked from Referencer:



def referencer_config():
dlg = ConfigDialog()
dlg.mainWindow.run()

class ConfigDialog:
def __init__(self):
# Initialise the UI builder
self.builder = gtk.Builder()
self.builder.add_from_file(CONFIG_DIALOG_GLADE_FILE)
self.builder.connect_signals(self)

# Fetch all relevant widgets in the dialog
self.mainWindow=self.builder.get_object("dlgConfig")
self.fileChooser=self.builder.get_object("fcbNotesPath")

# Initialise the currently configured directory...
self.fileChooser.set_filename(NOTES_DIRECTORY)

def config_ok_click(self, widget, data=None):
set_notes_directory(self.fileChooser.get_filename())


Thank you very much for your help!


Cheers,
---
Matej
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://icculus.org/pipermail/referencer/attachments/20100622/2bd67a82/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://icculus.org/pipermail/referencer/attachments/20100622/2bd67a82/attachment.pgp>
Matej Urbas
2010-06-22 23:05:11 UTC
Permalink
Hi!

I have resolved the issue.

The 'gtk.Builder' class tried to find the UI definition file via a
relative path. Constructing an absolute path fixed this.

The code is available here:
https://urbas.si/pub/Public/Programming/ReferencerNotes/

Cheers!
Post by John Spray
---------- Forwarded message ----------
From: Matej Urbas <matej.urbas at gmail.com>
Date: Tue, Jun 22, 2010 at 1:06 AM
Subject: Referencer Plugin: Configuration Dialog
To: jcspray at icculus.org
Hi!
Could I please ask you for advice on how to display a configuration
dialog for a python plugin in Referencer?
This is my current code (excerpt from file 'ReferencerNotes.py'), which
dlg = ConfigDialog()
dlg.mainWindow.run()
# Initialise the UI builder
self.builder = gtk.Builder()
self.builder.add_from_file(CONFIG_DIALOG_GLADE_FILE)
self.builder.connect_signals(self)
# Fetch all relevant widgets in the dialog
self.mainWindow=self.builder.get_object("dlgConfig")
self.fileChooser=self.builder.get_object("fcbNotesPath")
# Initialise the currently configured directory...
self.fileChooser.set_filename(NOTES_DIRECTORY)
set_notes_directory(self.fileChooser.get_filename())
Thank you very much for your help!
Cheers,
---
Matej
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://icculus.org/pipermail/referencer/attachments/20100623/d0c8d193/attachment.pgp>
Loading...