def __init__(self): gtk.Dialog.__init__(self) self.set_border_width(5) self.set_title(TEXT_TITLE) self.set_default_size(DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT) self.changes = [] keybinding = configuration.getKeybindingComplete() log.info("Got keybinding from gconf %s" % str(keybinding)) self.__setKeybinding(keybinding) self.table = gtk.Table(2, 2, homogeneous=False) self.table.set_row_spacings(4) self.table.set_col_spacings(4) self.vbox.pack_start(self.table, expand=False, fill=False, padding=4) lblKeybinding = gtk.Label() lblKeybinding.set_text(TEXT_KEYBINDING) self.table.attach(lblKeybinding, 0, 1, 0, 1, xoptions=False, yoptions=False) self.__kbWidget = keybindingwidget.KeybindingWidget() self.__kbWidget.setKeybinding(keybinding) self.table.attach(self.__kbWidget, 1, 2, 0, 1, xoptions=False, yoptions=False) lblhxmlfile = gtk.Label() lblhxmlfile.set_text(TEXT_HXMLFILE) self.table.attach(lblhxmlfile,0 , 1, 1, 2, xoptions=False, yoptions=False) self.__fcDialog = gtk.FileChooserDialog("Select HXML file",self,gtk.FILE_CHOOSER_ACTION_OPEN,(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OPEN,gtk.RESPONSE_OK)) oldFile = configuration.getHxmlFile() if oldFile != None: self.__fcDialog.set_filename(oldFile) self.__fcDialog.connect('response',self.__closeFC,self); self.__fcWidget = gtk.FileChooserButton(self.__fcDialog) self.table.attach(self.__fcWidget,1 ,2 ,1 ,2 , xoptions=False, yoptions=False) # Buttons in the action area btnClose = gtk.Button(stock=gtk.STOCK_CLOSE) self.__btnApply = gtk.Button(stock=gtk.STOCK_APPLY) self.__btnApply.set_sensitive(False) btnClear = gtk.Button(stock=gtk.STOCK_CLEAR) self.action_area.add(btnClear) self.action_area.add(self.__btnApply) self.action_area.add(btnClose) # Connect all signals self.__kbWidget.connect("keybinding-changed", self.on_keybinding_changed) btnClose.connect("clicked", self.close) self.__btnApply.connect("clicked", self.applyChanges) btnClear.connect("clicked", self.clearChanges) self.connect('delete-event', self.close) self.show_all()
def __init__(self): gtk.Dialog.__init__(self) self.set_border_width(5) self.set_title(TEXT_TITLE) self.set_default_size(DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT) self.changes = [] keybinding = configuration.getKeybindingComplete() log.info("Got keybinding from gconf %s" % str(keybinding)) self.__setKeybinding(keybinding) self.table = gtk.Table(2, 2, homogeneous=False) self.table.set_row_spacings(4) self.table.set_col_spacings(4) self.vbox.pack_start(self.table, expand=False, fill=False, padding=4) lblKeybinding = gtk.Label() lblKeybinding.set_text(TEXT_KEYBINDING) self.table.attach(lblKeybinding, 0, 1, 0, 1, xoptions=False, yoptions=False) self.__kbWidget = keybindingwidget.KeybindingWidget() self.__kbWidget.setKeybinding(keybinding) self.table.attach(self.__kbWidget, 1, 2, 0, 1, xoptions=False, yoptions=False) # Buttons in the action area btnClose = gtk.Button(stock=gtk.STOCK_CLOSE) self.__btnApply = gtk.Button(stock=gtk.STOCK_APPLY) self.__btnApply.set_sensitive(False) btnClear = gtk.Button(stock=gtk.STOCK_CLEAR) self.action_area.add(btnClear) self.action_area.add(self.__btnApply) self.action_area.add(btnClose) # Connect all signals self.__kbWidget.connect("keybinding-changed", self.on_keybinding_changed) btnClose.connect("clicked", self.close) self.__btnApply.connect("clicked", self.applyChanges) btnClear.connect("clicked", self.clearChanges) self.connect('delete-event', self.close) self.show_all()
def __init__(self): gtk.Dialog.__init__(self) self.set_border_width(5) self.set_title(TEXT_TITLE) self.set_default_size(DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT) self.changes = [] keybinding = configuration.getKeybindingComplete() log.info("Got keybinding from gconf %s" % str(keybinding)) self.__setKeybinding(keybinding) self.table = gtk.Table(2, 2, homogeneous=False) self.table.set_row_spacings(4) self.table.set_col_spacings(4) self.vbox.pack_start(self.table, expand=False, fill=False, padding=4) lblKeybinding = gtk.Label() lblKeybinding.set_text(TEXT_KEYBINDING) self.table.attach(lblKeybinding, 0, 1, 0, 1, xoptions=False, yoptions=False) self.__kbWidget = keybindingwidget.KeybindingWidget() self.__kbWidget.setKeybinding(keybinding) self.table.attach(self.__kbWidget, 1, 2, 0, 1, xoptions=False, yoptions=False) lblhxmlfile = gtk.Label() lblhxmlfile.set_text(TEXT_HXMLFILE) self.table.attach(lblhxmlfile, 0, 1, 1, 2, xoptions=False, yoptions=False) self.__fcDialog = gtk.FileChooserDialog( "Select HXML file", self, gtk.FILE_CHOOSER_ACTION_OPEN, (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN, gtk.RESPONSE_OK)) oldFile = configuration.getHxmlFile() if oldFile != None: self.__fcDialog.set_filename(oldFile) self.__fcDialog.connect('response', self.__closeFC, self) self.__fcWidget = gtk.FileChooserButton(self.__fcDialog) self.table.attach(self.__fcWidget, 1, 2, 1, 2, xoptions=False, yoptions=False) # Buttons in the action area btnClose = gtk.Button(stock=gtk.STOCK_CLOSE) self.__btnApply = gtk.Button(stock=gtk.STOCK_APPLY) self.__btnApply.set_sensitive(False) btnClear = gtk.Button(stock=gtk.STOCK_CLEAR) self.action_area.add(btnClear) self.action_area.add(self.__btnApply) self.action_area.add(btnClose) # Connect all signals self.__kbWidget.connect("keybinding-changed", self.on_keybinding_changed) btnClose.connect("clicked", self.close) self.__btnApply.connect("clicked", self.applyChanges) btnClear.connect("clicked", self.clearChanges) self.connect('delete-event', self.close) self.show_all()
def create_widget(self): self.changes = [] keybinding = configuration.getKeybindingComplete() self.__setKeybinding(keybinding) #Image + title box l = Gtk.Label() l.set_markup("<b>Code completion settings</b>") titleBox = Gtk.HBox(homogeneous=False, spacing=10) titleBox.set_halign(Gtk.Align.CENTER) titleBox.pack_start(Gtk.Image.new_from_file("haxe_logo_32.png"), expand=True, fill=True, padding=0) titleBox.pack_start(l, expand=True, fill=True, padding=0) # Select hxml file box self.hxmlfolderLabel = Gtk.Label("-swf-version 9 -swf /tmp/void.swf") fileChooserBtn = Gtk.FileChooserButton( "Select hxml file", Gtk.FileChooserAction.OPEN ) #,(Gtk.STOCK_CANCEL,Gtk.ResponseType.CANCEL,Gtk.STOCK_OPEN,Gtk.ResponseType.OK)) fileChooserBtn.set_size_request(200, 20) filter = Gtk.FileFilter() filter.set_name("*.hxml") filter.add_pattern("*.hxml") fileChooserBtn.add_filter(filter) self.handler_id = fileChooserBtn.connect("file-set", self.onHxmlFileSelect) self.handler_id2 = fileChooserBtn.connect("selection-changed", self.onHxmlFileSelect) oldFile = configuration.getHxmlFile() if oldFile != None: self.hxmlfolderLabel.set_text(os.path.dirname(oldFile)) fileChooserBtn.set_filename(oldFile) fileChooserBox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=10) fileChooserBox.pack_start(self.hxmlfolderLabel, expand=True, fill=True, padding=0) fileChooserBox.pack_start(fileChooserBtn, expand=True, fill=True, padding=0) hxmlBox = Gtk.HBox(homogeneous=False, spacing=10) hxmlBox.set_halign(Gtk.Align.START) l = Gtk.Label() l.set_markup("* Select hxml file:") hxmlBox.pack_start(l, expand=True, fill=True, padding=0) hxmlBox.pack_start(fileChooserBox, expand=True, fill=True, padding=0) # use keybinding complete box self.keybindingInput = keybindingwidget.KeybindingWidget() self.keybindingInput.setKeybinding(keybinding) self.keybindingInput.connect("keybinding-changed", self.on_keybinding_changed) useKeybindingBox = Gtk.HBox(homogeneous=False, spacing=10) useKeybindingBox.set_halign(Gtk.Align.START) useKeybindingBox.pack_start(Gtk.Label("* Show popup with keybinding:"), expand=True, fill=True, padding=0) useKeybindingBox.pack_start(self.keybindingInput, expand=True, fill=True, padding=0) # use dot complete box useDotCompleteBtn = Gtk.CheckButton() useDotCompleteBtn.set_active(configuration.getDotComplete()) useDotCompleteBtn.connect('toggled', self.on_check_button_toggled) useDotCompletionBox = Gtk.HBox(homogeneous=False, spacing=10) useDotCompletionBox.set_halign(Gtk.Align.START) useDotCompletionBox.pack_start(Gtk.Label("* Show popup after dot:"), expand=True, fill=True, padding=0) useDotCompletionBox.pack_start(useDotCompleteBtn, expand=True, fill=True, padding=0) # popup window configuration escHideCompleteBtn = Gtk.CheckButton("Hide popup with <ESC>") escHideCompleteBtn.set_active(configuration.getEscHideComplete()) escHideCompleteBtn.connect('toggled', self.onEscHideCompleteToggle) emptyHideCompleteBtn = Gtk.CheckButton( "Hide popup when the list is empty") emptyHideCompleteBtn.set_active(configuration.getEmptyHideComplete()) emptyHideCompleteBtn.connect('toggled', self.onEmptyHideCompleteToggle) spaceCompleteBtn = Gtk.CheckButton("Complete with <SPACE>") spaceCompleteBtn.set_active(configuration.getSpaceComplete()) spaceCompleteBtn.connect('toggled', self.onSpaceCompleteToggle) tabCompleteBtn = Gtk.CheckButton("Complete with <TAB>") tabCompleteBtn.set_active(configuration.getTabComplete()) tabCompleteBtn.connect('toggled', self.onTabCompleteToggle) enterCompleteBtn = Gtk.CheckButton("Complete with <ENTER>") enterCompleteBtn.set_active(configuration.getEnterComplete()) enterCompleteBtn.connect('toggled', self.onEnterCompleteToggle) nonAlphaCompleteBtn = Gtk.CheckButton( "Complete with non alpha numeric") nonAlphaCompleteBtn.set_active(configuration.getNonAlphaComplete()) nonAlphaCompleteBtn.connect('toggled', self.onNonAlphaCompleteToggle) doubleDotCompleteBtn = Gtk.CheckButton( "Complete with dot key and relaunch popup") doubleDotCompleteBtn.set_active(configuration.getDoubleDotComplete()) doubleDotCompleteBtn.connect('toggled', self.onDoubleDotCompleteToggle) # apply clear button box self.btnApply = Gtk.Button(stock=Gtk.STOCK_APPLY) self.btnApply.set_sensitive(False) self.btnApply.connect("clicked", self.applyChanges) self.btnClear = Gtk.Button(stock=Gtk.STOCK_CLEAR) self.btnClear.connect("clicked", self.clearChanges) buttonBox = Gtk.HBox(homogeneous=False, spacing=10) buttonBox.set_halign(Gtk.Align.CENTER) buttonBox.pack_start(self.btnApply, expand=False, fill=False, padding=0) buttonBox.pack_start(self.btnClear, expand=False, fill=False, padding=0) #VBox containing all widgets (to be returned for the configuration dialog) vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=10) vbox.pack_start(titleBox, expand=True, fill=True, padding=0) vbox.pack_start(hxmlBox, expand=True, fill=True, padding=0) vbox.pack_start(useKeybindingBox, expand=True, fill=True, padding=0) vbox.pack_start(useDotCompletionBox, expand=True, fill=True, padding=0) l = Gtk.Label() l.set_markup("<b>Popup configuration</b>") vbox.pack_start(l, expand=True, fill=True, padding=0) vbox.pack_start(escHideCompleteBtn, expand=True, fill=True, padding=0) vbox.pack_start(emptyHideCompleteBtn, expand=True, fill=True, padding=0) vbox.pack_start(spaceCompleteBtn, expand=True, fill=True, padding=0) vbox.pack_start(tabCompleteBtn, expand=True, fill=True, padding=0) vbox.pack_start(enterCompleteBtn, expand=True, fill=True, padding=0) vbox.pack_start(nonAlphaCompleteBtn, expand=True, fill=True, padding=0) vbox.pack_start(doubleDotCompleteBtn, expand=True, fill=True, padding=0) #vbox.pack_start(table, expand=True, fill=True, padding=0) vbox.pack_start(buttonBox, expand=True, fill=True, padding=0) #vbox.set_size_request(500, 300) #vbox.set_halign(Gtk.Align.CENTER) #vbox.set_halign(Gtk.Align.FILL) #vbox.set_valign(Gtk.Align.FILL) #vbox.set_hexpand(True) #vbox.set_vexpand(True) vbox.set_margin_left(20) vbox.set_margin_top(20) vbox.set_margin_right(20) vbox.set_margin_bottom(20) #vbox.show_all() return vbox