コード例 #1
0
	def __init__(self):
		'''Load config and create UI'''

		self.config = utils.NemoCompareConfig()
		self.config.load()

		# find out if some new engines have been installed
		self.config.add_missing_predefined_engines()

		# initialize i18n
		locale.setlocale(locale.LC_ALL, '')
		gettext.bindtextdomain(utils.APP)
		gettext.textdomain(utils.APP)
		_ = gettext.gettext

		self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
		#self.window.set_position(gtk.WIN_POS_CENTER)
		icon=self.window.render_icon(gtk.STOCK_PREFERENCES, gtk.ICON_SIZE_DIALOG)
		self.window.set_icon(icon)
		self.window.set_resizable(False)
		self.window.set_title(_("Nemo Compare Extension Preferences"))
		self.window.connect("delete_event",self.cancel_event)
		self.window.set_border_width(15)

		main_vbox = gtk.VBox(False, 0)
		self.window.add(main_vbox)

		# normal diff
		frame = gtk.Frame(_("Normal Diff"))
		self.combo = gtk.combo_box_entry_new_text()
		for text in self.config.engines:
			if text == self.config.diff_engine:
				combo_add_and_select(self.combo, text)
			else:
				self.combo.append_text(text)
		self.combo.connect('changed', self.changed_cb)
		frame.add(self.combo)
		main_vbox.pack_start(frame, True, True, 0)

		# 3-way diff
		frame_3way = gtk.Frame(_("Three-Way Diff"))
		self.combo_3way = gtk.combo_box_entry_new_text()
		for text in self.config.engines:
			if text == self.config.diff_engine_3way:
				combo_add_and_select(self.combo_3way, text)
			else:
				self.combo_3way.append_text(text)
		self.combo_3way.connect('changed', self.changed_cb)
		frame_3way.add(self.combo_3way)
		main_vbox.pack_start(frame_3way, True, True, 0)

		# n-way diff
		frame_multi = gtk.Frame(_("N-Way Diff"))
		self.combo_multi = gtk.combo_box_entry_new_text()
		for text in self.config.engines:
			if text == self.config.diff_engine_multi:
				combo_add_and_select(self.combo_multi, text)
			else:
				self.combo_multi.append_text(text)
		self.combo_multi.connect('changed', self.changed_cb)
		frame_multi.add(self.combo_multi)
		main_vbox.pack_start(frame_multi, True, True, 0)

		separator = gtk.HBox(False,5)
		main_vbox.pack_start(separator, False, True, 5)

		# cancel / ok
		confirm_hbox = gtk.HBox(False,0)
		main_vbox.pack_start(confirm_hbox, False, False, 0)
		
		cancel_button = gtk.Button(stock=gtk.STOCK_CANCEL)
		cancel_button.connect_object("clicked", self.cancel_event, self.window, None)  
		confirm_hbox.pack_start(cancel_button, True, True, 5)

		ok_button = gtk.Button(stock=gtk.STOCK_OK)
		ok_button.connect_object("clicked", self.save_event, self.window, None)  
		confirm_hbox.pack_start(ok_button, True, True, 5)

		self.window.show_all()
コード例 #2
0
    def __init__(self):
        '''Load config'''

        self.config = utils.NemoCompareConfig()
        self.config.load()
コード例 #3
0
    def __init__(self):
        '''Load config and create UI'''

        self.config = utils.NemoCompareConfig()
        self.config.load()

        # find out if some new engines have been installed
        self.config.add_missing_predefined_engines()

        # initialize i18n
        locale.setlocale(locale.LC_ALL, '')
        gettext.bindtextdomain("nemo-extensions")
        gettext.textdomain("nemo-extensions")
        _ = gettext.gettext

        self.window = Gtk.Window.new(Gtk.WindowType.TOPLEVEL)
        self.window.set_position(Gtk.WindowPosition.CENTER)
        self.window.set_icon_name("preferences-other")
        self.window.set_resizable(False)
        self.window.set_title(_("Nemo Compare"))
        self.window.connect("delete_event", self.cancel_event)
        self.window.set_border_width(15)

        main_vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0)
        self.window.add(main_vbox)

        # normal diff
        frame = Gtk.Frame.new(_("Normal Diff"))
        self.combo = Gtk.ComboBoxText.new_with_entry()

        for text in self.config.engines:
            if text == self.config.diff_engine:
                combo_add_and_select(self.combo, text)
            else:
                self.combo.append_text(text)

        self.combo.connect('changed', self.changed_cb)

        frame.add(self.combo)
        main_vbox.pack_start(frame, True, True, 0)

        # 3-way diff
        frame_3way = Gtk.Frame.new(_("Three-Way Diff"))
        self.combo_3way = Gtk.ComboBoxText.new_with_entry()

        for text in self.config.engines:
            if text == self.config.diff_engine_3way:
                combo_add_and_select(self.combo_3way, text)
            else:
                self.combo_3way.append_text(text)

        self.combo_3way.connect('changed', self.changed_cb)

        frame_3way.add(self.combo_3way)
        main_vbox.pack_start(frame_3way, True, True, 0)

        # n-way diff
        frame_multi = Gtk.Frame.new(_("N-Way Diff"))
        self.combo_multi = Gtk.ComboBoxText.new_with_entry()

        for text in self.config.engines:
            if text == self.config.diff_engine_multi:
                combo_add_and_select(self.combo_multi, text)
            else:
                self.combo_multi.append_text(text)

        self.combo_multi.connect('changed', self.changed_cb)

        frame_multi.add(self.combo_multi)
        main_vbox.pack_start(frame_multi, True, True, 0)

        separator = Gtk.Separator(orientation=Gtk.Orientation.HORIZONTAL)
        main_vbox.pack_start(separator, False, True, 5)

        # cancel / ok
        confirm_hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL,
                               spacing=0)
        main_vbox.pack_start(confirm_hbox, False, False, 0)

        cancel_button = Gtk.Button.new_from_icon_name("dialog-cancel",
                                                      Gtk.IconSize.BUTTON)
        cancel_button.connect_object("clicked", self.cancel_event, self.window,
                                     None)
        confirm_hbox.pack_start(cancel_button, True, True, 5)

        ok_button = Gtk.Button.new_from_icon_name("dialog-ok",
                                                  Gtk.IconSize.BUTTON)
        ok_button.connect_object("clicked", self.save_event, self.window, None)
        confirm_hbox.pack_start(ok_button, True, True, 5)

        self.window.show_all()
        self.window.present()