def __init__(self, template_key, previewfile=None, gladefile=None): gtk.Dialog.__init__(self, "Importing %s" % template_key, None, gtk.DIALOG_MODAL|gtk.DIALOG_DESTROY_WITH_PARENT, (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_OK, gtk.RESPONSE_ACCEPT)) self.set_size_request(520,480) # create a new importer based on the template self.template = dataio.import_templates[template_key] self.importer = self.template.new_instance() # # set up connectors # self.connectors = pwglade.construct_connectors(self.importer) table_options = pwglade.construct_table(self.connectors) widget = uihelper.new_section("Import Options", table_options) self.vbox.pack_start(widget,False,True) for c in self.connectors: c.check_in() # # add preview widget # preview = self.construct_preview(previewfile) self.vbox.pack_start(preview,True,True) hint = gtk.Label() hint.set_markup("<i>Hint: These importer settings can later on be retrieved\nas 'recently used' template in the Edit|Preferences dialog.</i>") hint.set_use_markup(True) self.vbox.pack_start(hint,False,True) self.vbox.show_all()
def __init__(self, owner, title="Edit Options", parent=None): """ owner: instance of HasProps that owns the properties parent: parent window @note: 'parent' is currently ignored, since it produces a silly window placement! """ gtk.Dialog.__init__(self, title, None, gtk.DIALOG_MODAL|gtk.DIALOG_DESTROY_WITH_PARENT, (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_OK, gtk.RESPONSE_ACCEPT)) self.owner = owner self.connectors = pwglade.construct_connectors(owner) if len(self.connectors) == 0: raise NoOptionsError table = pwglade.construct_table(self.connectors) frame = uihelper.new_section(title, table) self.vbox.pack_start(frame, False, True) self.show_all()