コード例 #1
0
    def __init__(self, pageview, notebook, page, screenshot_command,
                 default_choice, cmd):
        Dialog.__init__(self, pageview,
                        _('Insert Screenshot'))  # T: dialog title
        self.pageview = pageview
        self.screenshot_command = screenshot_command
        if ScreenshotPicker.has_select_cmd(self.screenshot_command):
            self.screen_radio = Gtk.RadioButton.new_with_mnemonic_from_widget(
                None, _('Capture whole screen')
            )  # T: option in 'insert screenshot' dialog
            self.select_radio = Gtk.RadioButton.new_with_mnemonic_from_widget(
                self.screen_radio, _('Select window or region')
            )  # T: option in 'insert screenshot' dialog
            self.vbox.add(self.screen_radio)
            self.vbox.add(self.select_radio)
            if default_choice == 'Fullscreen':
                self.screen_radio.set_active(True)
            else:
                self.select_radio.set_active(True)

        self.cmd = cmd
        if ScreenshotPicker.has_delay_cmd(self.screenshot_command):
            hbox = Gtk.HBox()
            self.vbox.add(hbox)
            hbox.add(Gtk.Label(label=_('Delay') +
                               ': '))  # T: input in 'insert screenshot' dialog
            self.time_spin = Gtk.SpinButton()
            self.time_spin.set_range(0, 99)
            self.time_spin.set_increments(1, 5)
            self.time_spin.set_value(0)
            hbox.add(self.time_spin)
            hbox.add(Gtk.Label(label=' ' +
                               _('seconds')))  # T: label behind timer
コード例 #2
0
ファイル: uiactions.py プロジェクト: robla/zim-desktop-wiki
	def __init__(self, widget, file):
		Dialog.__init__(self, widget, _('File Exists'), buttons=None) # T: Dialog title
		self.add_help_text( _('''\
A file with the name <b>"%s"</b> already exists.
You can use another name or overwrite the existing file.''' % file.basename),
		) # T: Dialog text in 'new filename' dialog
		self.folder = file.parent()
		self.old_file = file

		suggested_filename = self.folder.new_file(file.basename).basename
		self.add_form((
				('name', 'string', _('Filename')), # T: Input label
			), {
				'name': suggested_filename
			}
		)
		self.form.widgets['name'].set_check_func(self._check_valid)

		# all buttons are defined in this class, to get the ordering right
		# [show folder]      [overwrite] [cancel] [ok]
		button = Gtk.Button.new_with_mnemonic(_('_Browse')) # T: Button label
		button.connect('clicked', self.do_show_folder)
		self.action_area.add(button)
		self.action_area.set_child_secondary(button, True)

		button = Gtk.Button.new_with_mnemonic(_('Overwrite')) # T: Button label
		button.connect('clicked', self.do_response_overwrite)
		self.add_action_widget(button, Gtk.ResponseType.NONE)

		self.add_button(_('_Cancel'), Gtk.ResponseType.CANCEL) # T: Button label
		self.add_button(_('_OK'), Gtk.ResponseType.OK) # T: Button label
		self._no_ok_action = False

		self.form.widgets['name'].connect('focus-in-event', self._on_focus)
コード例 #3
0
ファイル: tableeditor.py プロジェクト: wiwie/zim_tableeditor
	def __init__(self, ui, pageview, table=None, edit=False):
		if not edit:
			Dialog.__init__(self, ui, _('Insert Table'), # T: Dialog title
				button=(_('_Insert'), 'gtk-ok'),  # T: Button label
				buttons=gtk.BUTTONS_OK_CANCEL)
		else:
			Dialog.__init__(self, ui, _('Edit Table'), # T: Dialog title
				button=(_('_Edit'), 'gtk-ok'),  # T: Button label
				buttons=gtk.BUTTONS_OK_CANCEL)
		self.edit = edit
		self.table = table
		self.pageview = pageview
		
		self.rownames = gtk.ListStore(int, gobject.TYPE_STRING)
		self.columnNames = gtk.ListStore(int, str)

		self.template = get_template('plugins', 'equationeditor.tex')
		self.texfile = TmpFile(self.scriptname)
		
		self.rowIds = [1,2]
		self.colIds = [1,2]
		if table is not None:
			self.init_table(table=self.table)
		else:
			self.init_table()
コード例 #4
0
ファイル: screenshot.py プロジェクト: pombredanne/zim
    def __init__(self, window, notebook, page):
        Dialog.__init__(self, window,
                        _('Insert Screenshot'))  # T: dialog title
        if COMMAND == 'scrot':
            self.screen_radio = gtk.RadioButton(
                None, _('Capture whole screen'
                        ))  # T: option in 'insert screenshot' dialog
            self.select_radio = gtk.RadioButton(
                self.screen_radio, _('Select window or region')
            )  # T: option in 'insert screenshot' dialog
            self.vbox.add(self.screen_radio)
            self.vbox.add(self.select_radio)

        self.notebook = notebook
        self.page = page

        hbox = gtk.HBox()
        self.vbox.add(hbox)
        hbox.add(gtk.Label(_('Delay') +
                           ': '))  # T: input in 'insert screenshot' dialog
        self.time_spin = gtk.SpinButton()
        self.time_spin.set_range(0, 99)
        self.time_spin.set_increments(1, 5)
        hbox.add(self.time_spin)
        hbox.add(gtk.Label(' ' + _('seconds')))  # T: label behind timer
コード例 #5
0
	def __init__(self, ui, mimetype):
		'''Constructor
		@param ui: the parent window or C{GtkInterface} object
		@param mimetype: mime-type for which we want to create a new
		application
		'''
		Dialog.__init__(self, ui, _('Configure Applications'),  # T: Dialog title
			buttons=gtk.BUTTONS_CLOSE, help='Help:Default Applications')
		self.mimetype = mimetype
		self.add_text(_mimetype_dialog_text(mimetype))

		# Combo to set default
		self.default_combo = ApplicationComboBox()
		self.default_combo.connect('changed', self.on_default_changed)
		hbox = gtk.HBox(spacing=12)
		self.vbox.add(hbox)
		hbox.pack_start(gtk.Label(_('Default')+':'), False) # T: label for default application
		hbox.pack_start(self.default_combo)

		# Button to add new
		button = gtk.Button(_('Add Application'))
			# T: Button for adding a new application to the 'open with' menu
		button.connect('clicked', self.on_add_application)
		self.add_extra_button(button)

		self.reload()
コード例 #6
0
    def __init__(self, ui, plugin, pageview):
        Dialog.__init__(
            self,
            ui,
            _('Insert Symbol'),  # T: Dialog title
            button=(_('_Insert'), 'gtk-ok'),  # T: Button label
            defaultwindowsize=(350, 400))
        self.plugin = plugin
        self.pageview = pageview
        if not plugin.symbols:
            plugin.load_file()

        self.textentry = InputEntry()
        self.vbox.pack_start(self.textentry, False)

        # TODO make this iconview single-click
        model = gtk.ListStore(str, str)  # text, shortcut
        self.iconview = gtk.IconView(model)
        self.iconview.set_text_column(0)
        self.iconview.set_column_spacing(0)
        self.iconview.set_row_spacing(0)
        if gtk.gtk_version >= (2, 12, 0):
            self.iconview.set_property('has-tooltip', True)
            self.iconview.connect('query-tooltip', self.on_query_tooltip)
        self.iconview.connect('item-activated', self.on_activated)

        self.vbox.add(ScrolledWindow(self.iconview))

        button = gtk.Button(stock=gtk.STOCK_EDIT)
        button.connect('clicked', self.on_edit)
        self.action_area.add(button)
        self.action_area.reorder_child(button, 0)

        self.load_symbols()
コード例 #7
0
ファイル: screenshot.py プロジェクト: zrf1/zim-desktop-wiki
    def __init__(self, window, notebook, page, screenshot_command):
        Dialog.__init__(self, window,
                        _('Insert Screenshot'))  # T: dialog title
        self.app_window = window
        self.screenshot_command = screenshot_command
        if ScreenshotPicker.has_select_cmd(self.screenshot_command):
            self.screen_radio = gtk.RadioButton(
                None, _('Capture whole screen'
                        ))  # T: option in 'insert screenshot' dialog
            self.select_radio = gtk.RadioButton(
                self.screen_radio, _('Select window or region')
            )  # T: option in 'insert screenshot' dialog
            self.vbox.add(self.screen_radio)
            self.vbox.add(self.select_radio)

        self.notebook = notebook
        self.page = page
        if ScreenshotPicker.has_delay_cmd(self.screenshot_command):
            hbox = gtk.HBox()
            self.vbox.add(hbox)
            hbox.add(gtk.Label(_('Delay') +
                               ': '))  # T: input in 'insert screenshot' dialog
            self.time_spin = gtk.SpinButton()
            self.time_spin.set_range(0, 99)
            self.time_spin.set_increments(1, 5)
            self.time_spin.set_value(0)
            hbox.add(self.time_spin)
            hbox.add(gtk.Label(' ' + _('seconds')))  # T: label behind timer
コード例 #8
0
ファイル: customtools.py プロジェクト: DarioGT/Zim-QDA
    def __init__(self, ui):
        Dialog.__init__(self, ui, _('Custom Tools'), buttons=gtk.BUTTONS_CLOSE) # T: Dialog title
        self.set_help(':Help:Custom Tools')
        self.manager = CustomToolManager()

        self.add_help_text(_(
            'You can configure custom tools that will appear\n'
            'in the tool menu and in the tool bar or context menus.'
        ) ) # T: help text in "Custom Tools" dialog

        hbox = gtk.HBox(spacing=5)
        self.vbox.add(hbox)

        self.listview = CustomToolList(self.manager)
        hbox.add(self.listview)

        vbox = gtk.VBox(spacing=5)
        hbox.pack_start(vbox, False)

        for stock, handler, data in (
            (gtk.STOCK_ADD, self.__class__.on_add, None),
            (gtk.STOCK_EDIT, self.__class__.on_edit, None),
            (gtk.STOCK_DELETE, self.__class__.on_delete, None),
            (gtk.STOCK_GO_UP, self.__class__.on_move, -1),
            (gtk.STOCK_GO_DOWN, self.__class__.on_move, 1),
        ):
            button = IconButton(stock) # TODO tooltips for icon button
            if data:
                button.connect_object('clicked', handler, self, data)
            else:
                button.connect_object('clicked', handler, self)
            vbox.pack_start(button, False)
コード例 #9
0
	def __init__(self, dialog, plugin):
		Dialog.__init__(self, dialog, _('Configure Plugin')) # T: Dialog title
		self.plugin = plugin

		label = gtk.Label()
		label.set_markup(
			'<b>'+_('Options for plugin %s') % plugin.plugin_info['name']+'</b>')
			# T: Heading for 'configure plugin' dialog - %s is the plugin name
		self.vbox.add(label)

		fields = []
		for pref in self.plugin.plugin_preferences:
			if len(pref) == 4:
				key, type, label, default = pref
				self.plugin.preferences.setdefault(key, default) # just to be sure
			else:
				key, type, label, default, check = pref
				self.plugin.preferences.setdefault(key, default, check=check) # just to be sure

			if type in ('int', 'choice'):
				fields.append((key, type, label, check))
			else:
				fields.append((key, type, label))

		self.add_form(fields, self.plugin.preferences)
コード例 #10
0
ファイル: __init__.py プロジェクト: pombredanne/zim
	def __init__(self, ui, window_ext, vcs):
		Dialog.__init__(self, ui, _('Save Version'), # T: dialog title
			button=(None, 'gtk-save'), help='Plugins:Version Control')
		self.window_ext = window_ext
		self.vcs = vcs

		self.vbox.pack_start(
			gtk.Label(_("Please enter a comment for this version")), False)  # T: Dialog text

		vpaned = VPaned()
		self.vbox.add(vpaned)

		window, self.textview = ScrolledTextView(_('Saved version from zim'))
			# T: default version comment in the "save version" dialog
		self.textview.set_editable(True)
		vpaned.add1(window)

		vbox = gtk.VBox()
		vpaned.add2(vbox)

		label = gtk.Label('<b>'+_('Details')+'</b>')
			# T: section for version details in "save version" dialog
		label.set_use_markup(True)
		label.set_alignment(0, 0.5)
		vbox.pack_start(label, False)

		status = self.vcs.get_status()
		window, textview = ScrolledTextView(text=''.join(status), monospace=True)
		vbox.add(window)
コード例 #11
0
    def __init__(self, dialog, plugin):
        Dialog.__init__(self, dialog, _('Configure Plugin'))  # T: Dialog title
        self.plugin = plugin

        label = gtk.Label()
        label.set_markup('<b>' + _('Options for plugin %s') %
                         plugin.plugin_info['name'] + '</b>')
        # T: Heading for 'configure plugin' dialog - %s is the plugin name
        self.vbox.add(label)

        fields = []
        ignore = getattr(self.plugin, 'hide_preferences', [])
        for pref in self.plugin.plugin_preferences:
            if pref[0] in ignore:
                continue

            if len(pref) == 4:
                key, type, label, default = pref
                check = None
                self.plugin.preferences.setdefault(key,
                                                   default)  # just to be sure
            else:
                key, type, label, default, check = pref
                self.plugin.preferences.setdefault(
                    key, default, check=check)  # just to be sure

            if type in ('int', 'choice'):
                fields.append((key, type, label, check))
            else:
                fields.append((key, type, label))

        self.add_form(fields, self.plugin.preferences)
コード例 #12
0
    def __init__(self, parent):
        Dialog.__init__(self,
                        parent,
                        _('Custom Tools'),
                        buttons=Gtk.ButtonsType.CLOSE)  # T: Dialog title
        self.set_help(':Help:Custom Tools')
        self.manager = CustomToolManager()

        self.add_help_text(
            _('You can configure custom tools that will appear\n'
              'in the tool menu and in the tool bar or context menus.')
        )  # T: help text in "Custom Tools" dialog

        hbox = Gtk.HBox(spacing=5)
        self.vbox.pack_start(hbox, True, True, 0)

        self.listview = CustomToolList(self.manager)
        hbox.pack_start(self.listview, True, True, 0)

        vbox = Gtk.VBox(spacing=5)
        hbox.pack_start(vbox, False, True, 0)

        for stock, handler, data in (
            (Gtk.STOCK_ADD, self.__class__.on_add, None),
            (Gtk.STOCK_EDIT, self.__class__.on_edit, None),
            (Gtk.STOCK_DELETE, self.__class__.on_delete, None),
            (Gtk.STOCK_GO_UP, self.__class__.on_move, -1),
            (Gtk.STOCK_GO_DOWN, self.__class__.on_move, 1),
        ):
            button = IconButton(stock)  # TODO tooltips for icon button
            if data:
                button.connect_object('clicked', handler, self, data)
            else:
                button.connect_object('clicked', handler, self)
            vbox.pack_start(button, False, True, 0)
コード例 #13
0
ファイル: linkmap.py プロジェクト: vaginessa/zim-desktop-wiki
    def __init__(self, parent, linkmap, navigation):
        Dialog.__init__(self,
                        parent,
                        'LinkMap',
                        defaultwindowsize=(400, 400),
                        buttons=Gtk.ButtonsType.CLOSE)
        self.linkmap = linkmap
        self.navigation = navigation

        hbox = Gtk.HBox(spacing=5)
        self.vbox.pack_start(hbox, True, True, 0)

        self.xdotview = xdot.DotWidget()
        self.xdotview.set_filter('fdp')
        self.xdotview.set_dotcode(linkmap.get_dotcode())
        self.xdotview.connect('clicked', self.on_node_clicked)
        hbox.add(self.xdotview)

        vbox = Gtk.VBox()
        hbox.pack_start(vbox, False, False, 0)
        for stock, method in (
            (Gtk.STOCK_ZOOM_IN, self.xdotview.on_zoom_in),
            (Gtk.STOCK_ZOOM_OUT, self.xdotview.on_zoom_out),
            (Gtk.STOCK_ZOOM_FIT, self.xdotview.on_zoom_fit),
            (Gtk.STOCK_ZOOM_100, self.xdotview.on_zoom_100),
        ):
            button = IconButton(stock)
            button.connect('clicked', method)
            vbox.pack_start(button, False, True, 0)
コード例 #14
0
    def __init__(self, parent, mimetype):
        '''Constructor
		@param parent: the parent window or C{None}
		@param mimetype: mime-type for which we want to create a new
		application
		'''
        Dialog.__init__(
            self,
            parent,
            _('Configure Applications'),  # T: Dialog title
            buttons=Gtk.ButtonsType.CLOSE,
            help='Help:Default Applications')
        self.mimetype = mimetype
        self.add_text(_mimetype_dialog_text(mimetype))

        # Combo to set default
        self.default_combo = ApplicationComboBox()
        self.default_combo.connect('changed', self.on_default_changed)
        hbox = Gtk.HBox(spacing=12)
        self.vbox.add(hbox)
        hbox.pack_start(Gtk.Label(_('Default') + ':'), False, True,
                        0)  # T: label for default application
        hbox.pack_start(self.default_combo, True, True, 0)

        # Button to add new
        button = Gtk.Button.new_with_mnemonic(_('Add Application'))
        # T: Button for adding a new application to the 'open with' menu
        button.connect('clicked', self.on_add_application)
        self.add_extra_button(button)

        self.reload()
コード例 #15
0
ファイル: __init__.py プロジェクト: DarioGT/Zim-QDA
    def __init__(self, ui, vcs):
        Dialog.__init__(self, ui, _('Save Version'), # T: dialog title
            button=(None, 'gtk-save'), help='Plugins:Version Control')
        self.vcs = vcs

        self.vbox.pack_start(
            gtk.Label(_("Please enter a comment for this version")), False)  # T: Dialog text

        vpaned = VPaned()
        self.vbox.add(vpaned)

        window, self.textview = ScrolledTextView(_('Saved version from zim'))
            # T: default version comment in the "save version" dialog
        self.textview.set_editable(True)
        vpaned.add1(window)

        vbox = gtk.VBox()
        vpaned.add2(vbox)

        label = gtk.Label('<b>'+_('Details')+'</b>')
            # T: section for version details in "save version" dialog
        label.set_use_markup(True)
        label.set_alignment(0, 0.5)
        vbox.pack_start(label, False)

        status = self.vcs.get_status()
        window, textview = ScrolledTextView(text=''.join(status), monospace=True)
        vbox.add(window)
コード例 #16
0
    def __init__(self, parent, plugin, pageview):
        Dialog.__init__(
            self,
            parent,
            _('Insert Symbol'),  # T: Dialog title
            button=_('_Insert'),  # T: Button label
            defaultwindowsize=(350, 400))
        self.plugin = plugin
        self.pageview = pageview
        if not plugin.symbols:
            plugin.load_file()

        self.textentry = InputEntry()
        self.vbox.pack_start(self.textentry, False, True, 0)

        model = Gtk.ListStore(str, str)  # text, shortcut
        self.iconview = Gtk.IconView(model)
        self.iconview.set_text_column(0)
        self.iconview.set_column_spacing(0)
        self.iconview.set_row_spacing(0)
        self.iconview.set_property('has-tooltip', True)
        self.iconview.set_property('activate-on-single-click', True)
        self.iconview.connect('query-tooltip', self.on_query_tooltip)
        self.iconview.connect('item-activated', self.on_activated)

        swindow = ScrolledWindow(self.iconview)
        self.vbox.pack_start(swindow, True, True, 0)

        button = Gtk.Button.new_with_mnemonic(_('_Edit'))  # T: Button label
        button.connect('clicked', self.on_edit)
        self.action_area.add(button)
        self.action_area.reorder_child(button, 0)

        self.load_symbols()
コード例 #17
0
ファイル: quicknote.py プロジェクト: thejeshgn/Zim
	def __init__(self, ui, notebook=None, namespace=None, basename=None, append=None, text=None, template_options=None, attachments=None):
		self.config = get_config('quicknote.conf')
		self.uistate = self.config['QuickNoteDialog']

		Dialog.__init__(self, ui, _('Quick Note'))
		self._updating_title = False
		self._title_set_manually = not basename is None
		self.attachments = attachments

		if notebook and not isinstance(notebook, basestring):
			notebook = notebook.uri

		self.uistate.setdefault('lastnotebook', None, basestring)
		if self.uistate['lastnotebook']:
			notebook = notebook or self.uistate['lastnotebook']
			self.config['Namespaces'].setdefault(notebook, None, basestring)
			namespace = namespace or self.config['Namespaces'][notebook]

		self.form = InputForm()
		self.vbox.pack_start(self.form, False)

		# TODO dropdown could use an option "Other..."
		label = gtk.Label(_('Notebook')+': ')
		label.set_alignment(0.0, 0.5)
		self.form.attach(label, 0,1, 0,1, xoptions=gtk.FILL)
			# T: Field to select Notebook from drop down list
		self.notebookcombobox = NotebookComboBox(current=notebook)
		self.notebookcombobox.connect('changed', self.on_notebook_changed)
		self.form.attach(self.notebookcombobox, 1,2, 0,1)

		self._init_inputs(namespace, basename, append, text, template_options)

		self.uistate['lastnotebook'] = notebook
		self._set_autocomplete(notebook)
コード例 #18
0
    def __init__(self, window, index, uistate):

        Dialog.__init__(
            self,
            window,
            _('Tags Manager (IconTags plugin)'),  # T: dialog title
            buttons=gtk.BUTTONS_OK_CANCEL,
            defaultwindowsize=(450, 400))

        # Don't confuse with local variable 'self.uistate',
        # which is already determined for this class.
        self._window = window
        self.plugin_uistate = uistate
        self.show_pages_button = gtk.ToggleButton('Show Pages')
        self.show_pages_button.connect('toggled', self.toggle_show_pages)
        self.add_extra_button(self.show_pages_button)

        self.treeview_tags = TagsManagerTagsView(
            index, self.plugin_uistate['Icons for Tags'])
        self.treeview_pages = TagsManagerPagesView(index, window.ui)
        self.scrolled_widget = ScrolledWindow(self.treeview_tags)
        self.vbox.pack_start(self.scrolled_widget, True)

        self.treeview_tags.connect('row-activated', self.get_tag)

        # Enable left/right arrows to navigate between views.
        self.treeview_tags.connect('key-release-event', self.toggle_view)
        self.treeview_pages.connect('key-release-event', self.toggle_view)

        # Update if tags change.
        self.connectto_all(index, (('tag-inserted', lambda *a: self.update()),
                                   ('tag-removed', lambda *a: self.update())))

        self.show_all()
コード例 #19
0
	def __init__(self, widget, navigation, notebook, path=None, subpage=False):
		if subpage:
			title = _('New Page in %s') % path # T: Dialog title
		else:
			title = _('New Page') # T: Dialog title

		Dialog.__init__(self, widget, title,
			help_text=_(
				'Please note that linking to a non-existing page\n'
				'also creates a new page automatically.'),
			# T: Dialog text in 'new page' dialog
			help=':Help:Pages'
		)
		self.notebook = notebook
		self.navigation = navigation

		default = notebook.get_page_template_name(path)
		templates = [t[0] for t in list_templates('wiki')]
		if not default in templates:
			templates.insert(0, default)

		self.add_form([
			('page', 'page', _('Page Name'), path), # T: Input label
			('template', 'choice', _('Page Template'), templates) # T: Choice label
		])
		self.form['template'] = default
		# TODO: reset default when page input changed -
		# especially if namespace has other template

		self.form.set_default_activate('page') # close dialog on <Enter> immediatly, do not select template

		if subpage:
			self.form.widgets['page'].subpaths_only = True
コード例 #20
0
	def __init__(self, parent, definition=None):
		'''
		Constructor, which intializes the dialog window
		:param parent:
		:param definition: tuple of C{(ids, headers, wraps, aligns)}
		:return:
		'''
		title = _('Insert Table') if definition is None else _('Edit Table')  # T: Dialog title
		Dialog.__init__(self, parent, title)

		# Prepare treeview in which all columns of the table are listed
		self.default_column_item = [-1, "", 0, "left", Gtk.STOCK_JUSTIFY_LEFT, _("Left")]
		# currently edited cell - tuple (editable, path, colid) save it on exit
		self.currently_edited = None

		# Set layout of Window
		self.add_help_text(_('Managing table columns'))  # T: Description of "Table-Insert" Dialog
		self.set_default_size(380, 400)

		liststore = self._prepare_liststore(definition)
		self.treeview = self._prepare_treeview_with_headcolumn_list(liststore)
		hbox = Gtk.HBox(spacing=5)
		hbox.set_size_request(300, 300)
		self.vbox.pack_start(hbox, False, True, 0)
		header_scrolled_area = ScrolledWindow(self.treeview)
		header_scrolled_area.set_size_request(200, -1)
		hbox.pack_start(header_scrolled_area, True, True, 0)
		hbox.pack_start(self._button_box(), False, False, 0)

		self.show_all()
		if definition is None: # preselect first entry
			path = self.treeview.get_model().get_path(self.treeview.get_model().get_iter_first())
			self.treeview.set_cursor_on_cell(path, self.treeview.get_column(0), None, True)
コード例 #21
0
    def __init__(self, ui, default_tab=None, select_plugin=None):
        Dialog.__init__(self, ui, _('Preferences'))  # T: Dialog title
        gtknotebook = gtk.Notebook()
        self.vbox.add(gtknotebook)
        # saves a list of loaded plugins to be used later
        self.p_save_loaded = [p.__class__ for p in self.ui.plugins]

        # Dynamic tabs
        self.forms = {}
        for category, preferences in ui.preferences_register.items():
            vbox = gtk.VBox()
            index = gtknotebook.append_page(vbox, gtk.Label(_(category)))
            # From GTK Doc: Note that due to historical reasons, GtkNotebook refuses
            # to switch to a page unless the child widget is visible.
            vbox.show()
            if category == default_tab: gtknotebook.set_current_page(index)

            fields = []
            values = {}
            sections = {}
            for p in preferences:
                if len(p) == 4:
                    section, key, type, label = p
                    fields.append((key, type, label))
                else:
                    section, key, type, label, check = p
                    fields.append((key, type, label, check))

                values[key] = ui.preferences[section][key]
                sections[key] = section

            form = InputForm(fields, values)
            form.preferences_sections = sections
            vbox.pack_start(form, False)
            self.forms[category] = form

            if category == 'Interface':
                self._add_font_selection(form)

        # Styles tab
        #~ gtknotebook.append_page(StylesTab(self), gtk.Label(_('Styles')))

        # Keybindings tab
        #~ gtknotebook.append_page(KeyBindingsTab(self), gtk.Label(_('Key bindings')))

        # Plugins tab
        plugins_tab = PluginsTab(self, self.ui.plugins)
        plugins_tab_index = gtknotebook.append_page(plugins_tab,
                                                    gtk.Label(_('Plugins')))
        # T: Heading in preferences dialog
        plugins_tab.show()
        #~ print default_tab, index
        if default_tab == "Plugins":
            gtknotebook.set_current_page(plugins_tab_index)
            if not select_plugin is None:
                plugins_tab.select_plugin(select_plugin)

        # Applications tab
        gtknotebook.append_page(ApplicationsTab(self),
                                gtk.Label(_('Applications')))
コード例 #22
0
ファイル: linkmap.py プロジェクト: xbynet/zim-desktop-wiki
    def __init__(self, ui, linkmap, opener):
        Dialog.__init__(self,
                        ui,
                        'LinkMap',
                        defaultwindowsize=(400, 400),
                        buttons=gtk.BUTTONS_CLOSE)
        self.linkmap = linkmap
        self.opener = opener

        hbox = gtk.HBox(spacing=5)
        self.vbox.add(hbox)

        self.xdotview = xdot.DotWidget()
        self.xdotview.set_filter('fdp')
        self.xdotview.set_dotcode(linkmap.get_dotcode())
        self.xdotview.connect('clicked', self.on_node_clicked)
        hbox.add(self.xdotview)

        vbox = gtk.VBox()
        hbox.pack_start(vbox, False)
        for stock, method in (
            (gtk.STOCK_ZOOM_IN, self.xdotview.on_zoom_in),
            (gtk.STOCK_ZOOM_OUT, self.xdotview.on_zoom_out),
            (gtk.STOCK_ZOOM_FIT, self.xdotview.on_zoom_fit),
            (gtk.STOCK_ZOOM_100, self.xdotview.on_zoom_100),
        ):
            button = IconButton(stock)
            button.connect('clicked', method)
            vbox.pack_start(button, False)
コード例 #23
0
ファイル: customtools.py プロジェクト: DarioGT/Zim-QDA
    def __init__(self, ui, tool=None):
        Dialog.__init__(self, ui, _('Edit Custom Tool')) # T: Dialog title
        self.set_help(':Help:Custom Tools')
        self.vbox.set_spacing(12)

        if tool:
            name = tool.name
            comment = tool.comment
            execcmd = tool.execcmd
            readonly = tool.isreadonly
            toolbar = tool.showintoolbar
        else:
            name = ''
            comment = ''
            execcmd = ''
            readonly = False
            toolbar = False

        self.add_form((
            ('Name', 'string', _('Name')), # T: Input in "Edit Custom Tool" dialog
            ('Comment', 'string', _('Description')), # T: Input in "Edit Custom Tool" dialog
            ('X-Zim-ExecTool', 'string', _('Command')), # T: Input in "Edit Custom Tool" dialog
        ), {
            'Name': name,
            'Comment': comment,
            'X-Zim-ExecTool': execcmd,
        }, trigger_response=False)

        # FIXME need ui builder to take care of this as well
        self.iconbutton = IconChooserButton(stock=gtk.STOCK_EXECUTE)
        if tool and tool.icon and tool.icon != gtk.STOCK_EXECUTE:
            try:
                self.iconbutton.set_file(File(tool.icon))
            except Exception, error:
                logger.exception('Could not load: %s', tool.icon)
コード例 #24
0
ファイル: gui.py プロジェクト: Jam71/Zim-QDA
    def __init__(self, ui, linkmap):
        if ui_environment['platform'] == 'maemo':
            defaultsize = (800, 480)
            # The dialog hides the main window, so use all available screen anyway
            # setting defaultsize doesn't work because maemo makes the dialog
            # window as small as possible to fit the window's internal widgets
        else:
            defaultsize = (400, 400)
        Dialog.__init__(self, ui, 'LinkMap',
            defaultwindowsize=defaultsize, buttons=gtk.BUTTONS_CLOSE)
        self.linkmap = linkmap

        hbox = gtk.HBox(spacing=5)
        self.vbox.add(hbox)

        self.xdotview = xdot.DotWidget()
        self.xdotview.set_filter('fdp')
        self.xdotview.set_dotcode(linkmap.get_dotcode())
        self.xdotview.connect('clicked', self.on_node_clicked)
        hbox.add(self.xdotview)

        vbox = gtk.VBox()
        hbox.pack_start(vbox, False)
        for stock, method in (
            (gtk.STOCK_ZOOM_IN,  self.xdotview.on_zoom_in ),
            (gtk.STOCK_ZOOM_OUT, self.xdotview.on_zoom_out),
            (gtk.STOCK_ZOOM_FIT, self.xdotview.on_zoom_fit),
            (gtk.STOCK_ZOOM_100, self.xdotview.on_zoom_100),
        ):
            button = IconButton(stock)
            button.connect('clicked', method)
            vbox.pack_start(button, False)
コード例 #25
0
    def __init__(self, window, index, uistate):

        Dialog.__init__(self, window, _('Tags Manager (IconTags plugin)'), # T: dialog title
                        buttons=gtk.BUTTONS_OK_CANCEL,
                        defaultwindowsize=(450, 400) )

        # Don't confuse with local variable 'self.uistate',
        # which is already determined for this class.
        self._window = window
        self.plugin_uistate = uistate
        self.show_pages_button = gtk.ToggleButton('Show Pages')
        self.show_pages_button.connect('toggled', self.toggle_show_pages)
        self.add_extra_button(self.show_pages_button)

        self.treeview_tags = TagsManagerTagsView(index, self.plugin_uistate['Icons for Tags'])
        self.treeview_pages = TagsManagerPagesView(index, window.ui)
        self.scrolled_widget = ScrolledWindow(self.treeview_tags)
        self.vbox.pack_start(self.scrolled_widget, True)

        self.treeview_tags.connect('row-activated', self.get_tag)

        # Enable left/right arrows to navigate between views.
        self.treeview_tags.connect('key-release-event', self.toggle_view)
        self.treeview_pages.connect('key-release-event', self.toggle_view)

        # Update if tags change.
        self.connectto_all(index.update_iter.tags, (
            ('tag-row-inserted', lambda *a: self.update()),
            ('tag-row-deleted', lambda *a: self.update())
        ))

        self.show_all()
コード例 #26
0
ファイル: dialog.py プロジェクト: macattack5/linkanalysis
    def __init__(self, parent, notebook):
        Dialog.__init__(
            self,
            parent,
            _('Pages By Number Of Links'),  # T: dialog title
            buttons=gtk.BUTTONS_CLOSE)
        self.notebook = notebook

        self.direction_input = gtk.combo_box_new_text()
        for dir in sorted(self.LABELS):
            self.direction_input.append_text(self.LABELS[dir])

        self.uistate.setdefault('link_direction', LINK_DIR_BACKWARD,
                                self.LABELS.keys())
        gtk_combobox_set_active_text(
            self.direction_input, self.LABELS[self.uistate['link_direction']])
        self.direction_input.connect('changed',
                                     self.on_direction_input_changed)

        hbox = gtk.HBox()
        hbox.pack_start(gtk.Label(_('Trace Links') + ':'), False)
        hbox.add(self.direction_input)
        self.vbox.pack_start(hbox, False)

        self.listview = SingleClickTreeView(gtk.ListStore(int, str))
        self.listview.set_reorderable(True)
        for i, label in enumerate((_('#'), _('Page'))):
            column = gtk.TreeViewColumn(label, gtk.CellRendererText(), text=i)
            column.set_sort_column_id(i)
            self.listview.append_column(column)
        # TODO: self.listview.connect('row-activated', self.on_row_activated())

        self.vbox.add(ScrolledWindow(self.listview))
        self.populate_listview()
コード例 #27
0
    def __init__(self, dialog, plugin):
        Dialog.__init__(self, dialog, _('Configure Plugin'))  # T: Dialog title
        self.plugin = plugin

        label = Gtk.Label()
        label.set_markup('<b>' + _('Options for plugin %s') %
                         plugin.plugin_info['name'] + '</b>')
        # T: Heading for 'configure plugin' dialog - %s is the plugin name
        self.vbox.add(label)

        ignore = getattr(self.plugin, 'hide_preferences', [])
        fields = [
            field for field in self.plugin.form_fields(
                self.plugin.plugin_preferences) if field[0] not in ignore
        ]
        self.add_form(fields, self.plugin.preferences)

        if plugin.plugin_notebook_properties:
            hbox = Gtk.Box(spacing=12)
            hbox.add(
                Gtk.Image.new_from_icon_name('dialog-information',
                                             Gtk.IconSize.DIALOG))
            label = Gtk.Label()
            label.set_markup('<i>' + _(
                'This plugin also has properties,\nsee the notebook properties dialog'
            ) +  # T: info text in the preferences dialog
                             '</i>')
            hbox.add(label)
            self.vbox.pack_start(hbox, False, False, 18)
コード例 #28
0
ファイル: linkmap.py プロジェクト: gdw2/zim
	def __init__(self, ui, linkmap, opener):
		Dialog.__init__(self, ui, 'LinkMap',
			defaultwindowsize=(400, 400), buttons=gtk.BUTTONS_CLOSE)
		self.linkmap = linkmap
		self.opener = opener

		hbox = gtk.HBox(spacing=5)
		self.vbox.add(hbox)

		self.xdotview = xdot.DotWidget()
		self.xdotview.set_filter('fdp')
		self.xdotview.set_dotcode(linkmap.get_dotcode())
		self.xdotview.connect('clicked', self.on_node_clicked)
		hbox.add(self.xdotview)

		vbox = gtk.VBox()
		hbox.pack_start(vbox, False)
		for stock, method in (
			(gtk.STOCK_ZOOM_IN,  self.xdotview.on_zoom_in ),
			(gtk.STOCK_ZOOM_OUT, self.xdotview.on_zoom_out),
			(gtk.STOCK_ZOOM_FIT, self.xdotview.on_zoom_fit),
			(gtk.STOCK_ZOOM_100, self.xdotview.on_zoom_100),
		):
			button = IconButton(stock)
			button.connect('clicked', method)
			vbox.pack_start(button, False)
コード例 #29
0
ファイル: customtools.py プロジェクト: pombredanne/zim
	def __init__(self, ui, tool=None):
		Dialog.__init__(self, ui, _('Edit Custom Tool')) # T: Dialog title
		self.set_help(':Help:Custom Tools')
		self.vbox.set_spacing(12)

		if tool:
			name = tool.name
			comment = tool.comment
			execcmd = tool.execcmd
			readonly = tool.isreadonly
			toolbar = tool.showintoolbar
		else:
			name = ''
			comment = ''
			execcmd = ''
			readonly = False
			toolbar = False

		self.add_form((
			('Name', 'string', _('Name')), # T: Input in "Edit Custom Tool" dialog
			('Comment', 'string', _('Description')), # T: Input in "Edit Custom Tool" dialog
			('X-Zim-ExecTool', 'string', _('Command')), # T: Input in "Edit Custom Tool" dialog
		), {
			'Name': name,
			'Comment': comment,
			'X-Zim-ExecTool': execcmd,
		}, trigger_response=False)

		# FIXME need ui builder to take care of this as well
		self.iconbutton = IconChooserButton(stock=gtk.STOCK_EXECUTE)
		if tool and tool.icon and tool.icon != gtk.STOCK_EXECUTE:
			try:
				self.iconbutton.set_file(File(tool.icon))
			except Exception, error:
				logger.exception('Could not load: %s', tool.icon)
コード例 #30
0
ファイル: __init__.py プロジェクト: iancynk/zim-zotero-plugin
    def __init__(self, pageview, preferences):
        """Initialize the Input Box with options."""
        Dialog.__init__(
            self,
            pageview,
            _('Search in Zotero'),  # T: Dialog title
            button=_('_GO'),  # T: Button label
            defaultwindowsize=(350, 200))

        self.pageview = pageview
        self.textentry = InputEntry()
        self.vbox.pack_start(self.textentry, False, True, 0)
        self.preferences = preferences
        first = None
        options = [
            "Search in Title, Author and Date",
            "Search in All Fields and Tags", "Search Everywhere"
        ]
        for text in options:
            self.radio = Gtk.RadioButton.new_with_mnemonic_from_widget(
                first, text)
            if not first:
                first = self.radio
            self.vbox.pack_start(self.radio, False, True, 0)
            self.radio.show()
コード例 #31
0
ファイル: applications.py プロジェクト: DarioGT/Zim-QDA
    def __init__(self, ui, mimetype):
        '''Constructor
        @param ui: the parent window or C{GtkInterface} object
        @param mimetype: mime-type for which we want to create a new
        application
        '''
        Dialog.__init__(self, ui, _('Configure Applications'),  # T: Dialog title
            buttons=gtk.BUTTONS_CLOSE, help='Help:Default Applications')
        self.mimetype = mimetype
        self.add_text(_mimetype_dialog_text(mimetype))

        # Combo to set default
        self.default_combo = ApplicationComboBox()
        self.default_combo.connect('changed', self.on_default_changed)
        hbox = gtk.HBox(spacing=12)
        self.vbox.add(hbox)
        hbox.pack_start(gtk.Label(_('Default')+':'), False) # T: label for default application
        hbox.pack_start(self.default_combo)

        # Button to add new
        button = gtk.Button(_('Add Application'))
            # T: Button for adding a new application to the 'open with' menu
        button.connect('clicked', self.on_add_application)
        self.add_extra_button(button)

        self.reload()
コード例 #32
0
	def __init__(self, ui, query=None):
		Dialog.__init__(self, ui, _('Search'), # T: Dialog title
			buttons=gtk.BUTTONS_CLOSE, help='Help:Searching')

		hbox = gtk.HBox(spacing=5)
		self.vbox.pack_start(hbox, False)
		hbox.pack_start(gtk.Label(_('Search')+': '), False) # T: input label
		self.query_entry = gtk.Entry()
		hbox.add(self.query_entry)
		button = gtk.Button(stock=gtk.STOCK_FIND)
		hbox.pack_start(button, False)

		# TODO advanced query editor
		# TODO checkbox _('Match c_ase')
		# TODO checkbox _('Whole _word')

		scrollwindow = gtk.ScrolledWindow()
		scrollwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
		scrollwindow.set_shadow_type(gtk.SHADOW_IN)
		self.vbox.add(scrollwindow)

		self.results_treeview = SearchResultsTreeView(self.ui)
		scrollwindow.add(self.results_treeview)

		if query:
			self.query_entry.set_text(query)
			self.results_treeview.set_query(query)


		def search(*a):
			self.results_treeview.set_query( self.query_entry.get_text() )

		button.connect('clicked', search)
		self.query_entry.connect('activate', search)
コード例 #33
0
    def __init__(self, widget, notebook, path):
        Dialog.__init__(self, widget, _('Move Page'))  # T: Dialog title
        self.notebook = notebook
        self.path = path

        self.vbox.add(Gtk.Label(label=_('Move page "%s"') % self.path.name))
        # T: Heading in 'move page' dialog - %s is the page name

        try:
            i = self.notebook.links.n_list_links_section(
                path, LINK_DIR_BACKWARD)
        except IndexNotFoundError:
            i = 0

        label = ngettext('Update %i page linking to this page',
                         'Update %i pages linking to this page', i) % i
        # T: label in MovePage dialog - %i is number of backlinks
        # TODO update label to reflect that links can also be to child pages
        self.add_form([
            ('parent', 'namespace', _('Section'), self.path.parent),
            # T: Input label for the section to move a page to
            ('update', 'bool', label),
            # T: option in 'move page' dialog
        ])

        if i == 0:
            self.form['update'] = False
            self.form.widgets['update'].set_sensitive(False)
        else:
            self.form['update'] = True
コード例 #34
0
ファイル: cleannotebookdialog.py プロジェクト: thejeshgn/Zim
	def __init__(self, ui):
		Dialog.__init__(self, ui, _('Cleanup Attachments'), buttons=None) # T: dialog title
		self.set_default_size(600, 400)
		#self.set_help(':Help:Clean_Notebook') #TODO
		self.ui = ui

		self.ui.add_actions(ui_actions, self)
		self.ui.add_ui(ui_xml,self)

		# Buttons
		# [cancel] [delete]
		self.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
		self.add_button('Delete', gtk.RESPONSE_OK)
		self._no_ok_action = False

		button = gtk.Button(_('Invert Selection'))
			# T: Button in "Clean Notebook" dialog
		button.connect('clicked', self.do_response_toggle)
		self.action_area.add(button)
		self.action_area.set_child_secondary(button, True)

		self.add_help_text(_(
				'The files below were found in the attachment directory of zim but are no longer \n'
				'linked in the notebook. '
		) ) # T: help text in "Clean Notebook" dialog

		self.treeview = OrphanedFilesTreeView(ui)
		self.treeview.connect_object(
					'button-press-event', self.__class__.on_treeview_click, self)

		hbox = gtk.HBox(spacing=5)
		self.vbox.add(hbox)

		swindow = ScrolledWindow(self.treeview)
		hbox.add(swindow)
コード例 #35
0
ファイル: qdaCodesDialog.py プロジェクト: DarioGT/Zim-QDA
    def __init__(self, plugin):
        if ui_environment['platform'] == 'maemo':
            defaultsize = (800, 480)
        else:
            defaultsize = (900, 500)

        Dialog.__init__(self, plugin.ui, _('Qda Codes'),  # T: dialog title
            buttons=gtk.BUTTONS_CLOSE, help=':Plugins:Qda Codes',
            defaultwindowsize=defaultsize)

        self.plugin = plugin
        if ui_environment['platform'] == 'maemo':
            self.resize(800, 480)
            # Force maximum dialog size under maemo, otherwise
            # we'll end with a too small dialog and no way to resize it
            
        hbox = gtk.HBox(spacing=5)
        self.vbox.pack_start(hbox, False)
        self.hpane = HPaned()
        self.uistate.setdefault('hpane_pos', 75)
        self.hpane.set_position(self.uistate['hpane_pos'])
        self.vbox.add(self.hpane)

        # Code list
        self.qda_codes = QdaCodesTreeView(self.ui, plugin)
        self.qda_codes.set_headers_visible(True)  # Fix for maemo
        self.hpane.add2(ScrolledWindow(self.qda_codes))

        # Tag list
        self.tag_list = TagListTreeView(self.qda_codes)
        self.hpane.add1(ScrolledWindow(self.tag_list))

        # Filter input
        hbox.pack_start(gtk.Label(_('Filter') + ': '), False)  # T: Input label
        filter_entry = InputEntry()
        filter_entry.set_icon_to_clear()
        hbox.pack_start(filter_entry, False)
        filter_cb = DelayedCallback(500, lambda o: self.qda_codes.set_filter(filter_entry.get_text()))
        filter_entry.connect('changed', filter_cb)

        # Statistics label
        # self.statistics_label = gtk.Label()
        # hbox.pack_end(self.statistics_label, False)

        export_button = gtk.Button(_('_Export') )
        export_button.connect_object('clicked', self.qda_codes.get_data_as_page, self.qda_codes )
        hbox.pack_end(export_button, False )


        def on_qdacodes_changed(o):
            self.qda_codes.refresh()
            self.tag_list.refresh(self.qda_codes)
            # set_statistics()

        callback = DelayedCallback(10, on_qdacodes_changed)
            # Don't really care about the delay, but want to
            # make it less blocking - should be async preferably
            # now it is at least on idle

        self.connectto(plugin, 'qdacodes-changed', callback)
コード例 #36
0
ファイル: insertsymbol.py プロジェクト: DarioGT/Zim-QDA
    def __init__(self, ui, plugin):
        Dialog.__init__(self, ui, _('Insert Symbol'), # T: Dialog title
            button=(_('_Insert'), 'gtk-ok'),  # T: Button label
            defaultwindowsize=(350, 400) )
        self.plugin = plugin

        self.textentry = InputEntry()
        self.vbox.pack_start(self.textentry, False)

        # TODO make this iconview single-click
        model = gtk.ListStore(str, str) # text, shortcut
        self.iconview = gtk.IconView(model)
        self.iconview.set_text_column(0)
        self.iconview.set_column_spacing(0)
        self.iconview.set_row_spacing(0)
        if gtk.gtk_version >= (2, 12, 0):
            self.iconview.set_property('has-tooltip', True)
            self.iconview.connect('query-tooltip', self.on_query_tooltip)
        self.iconview.connect('item-activated', self.on_activated)

        self.vbox.add(ScrolledWindow(self.iconview))

        button = gtk.Button(stock=gtk.STOCK_EDIT)
        button.connect('clicked', self.on_edit)
        self.action_area.add(button)
        self.action_area.reorder_child(button, 0)

        self.load_symbols()
コード例 #37
0
    def __init__(self, parent, file):
        title = _('Rename file')  # T: dialog title
        Dialog.__init__(self, parent, title)

        assert isinstance(file,
                          LocalFile) and not isinstance(file, LocalFolder)
        self.old_file = file
        self.new_file = file

        # Add field for entering new filename.
        self.txt_filename = InputEntry()
        self.txt_filename.set_text(self.old_file.basename)
        self.txt_filename.set_activates_default(
            True)  # Make ENTER key press trigger the OK button.
        self.txt_filename.connect("changed", self.do_validate, parent)

        # Add field for showing hints when an error occurs (e.g. filename already exists).
        self.txt_error = Gtk.Label()
        self.txt_error.set_visible(False)

        # Add ok button.
        self.btn_ok = self.get_widget_for_response(
            response_id=Gtk.ResponseType.OK)
        self.btn_ok.set_can_default(True)
        self.btn_ok.grab_default()
        self.btn_ok.set_sensitive(False)

        # Configure dialog.
        self.set_modal(True)
        self.set_default_size(380, 100)
        self.vbox.pack_start(self.txt_filename, False, True, 0)
        self.vbox.pack_start(self.txt_error, False, True, 0)

        # Set focus to search field
        self.txt_filename.grab_focus()
コード例 #38
0
    def __init__(self, ui):
        Dialog.__init__(self,
                        ui,
                        _('Templates'),
                        help='Help:Templates',
                        buttons=gtk.BUTTONS_CLOSE,
                        defaultwindowsize=(400, 450))
        # T: Dialog title

        label = gtk.Label()
        label.set_markup('<b>' + _('Templates') + '</b>')
        # T: Section in dialog
        label.set_alignment(0.0, 0.5)
        self.vbox.pack_start(label, False)

        hbox = gtk.HBox()
        self.vbox.add(hbox)

        self.view = TemplateListView()
        self.view.connect('row-activated', self.on_selection_changed)
        hbox.add(ScrolledWindow(self.view))

        vbbox = gtk.VButtonBox()
        vbbox.set_layout(gtk.BUTTONBOX_START)
        hbox.pack_start(vbbox, False)

        view_button = Button(stock='gtk-file',
                             label=_('_View'))  # T: button label
        view_button.connect('clicked', self.on_view)

        copy_button = Button(stock='gtk-copy')
        copy_button.connect('clicked', self.on_copy)

        edit_button = Button(stock='gtk-edit')
        edit_button.connect('clicked', self.on_edit)

        delete_button = gtk.Button(stock='gtk-remove')
        delete_button.connect('clicked', self.on_delete)

        for b in (view_button, copy_button, edit_button, delete_button):
            b.set_alignment(0.0, 0.5)
            vbbox.add(b)

        browse_button = Button(_('Browse'))  # T: button label
        browse_button.connect('clicked', self.on_browse)
        self.add_extra_button(browse_button)

        self._buttonbox = vbbox
        self._delete_button = delete_button
        self.on_selection_changed()

        ## Same button appears in export dialog
        if gtk.gtk_version >= (2, 10) \
        and gtk.pygtk_version >= (2, 10):
            url_button = gtk.LinkButton(
                'http://zim-wiki.org/more_templates.html',
                _('Get more templates online')  # T: label for button with URL
            )
            self.vbox.pack_start(url_button, False)
コード例 #39
0
	def __init__(self, ui, callback=None):
		Dialog.__init__(self, ui, _('Open Notebook')) # T: dialog title
		# TODO set button to "OPEN" instead of "OK"
		self.callback = callback
		self.set_default_size(500, 400)
		self.set_help(':Help:Notebooks')

		# show some art work in an otherwise boring dialog
		path = data_file('globe_banner_small.png').path
		image = gtk.Image()
		image.set_from_file(path) # new_from_file not in 2.6
		align = gtk.Alignment(0,0.5, 0,0)
		align.add(image)
		self.vbox.pack_start(align, False)

		# split between treeview and vbuttonbox
		hbox = gtk.HBox(spacing=12)
		self.vbox.add(hbox)

		# add notebook list - open notebook on clicking a row
		self.treeview = NotebookTreeView()
		self.treeview.connect(
			'row-activated', lambda *a: self.response(gtk.RESPONSE_OK))

		swindow = gtk.ScrolledWindow()
		swindow.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
		swindow.set_shadow_type(gtk.SHADOW_IN)
		swindow.add(self.treeview)
		hbox.add(swindow)

		# add buttons for modifying the treeview
		vbbox = gtk.VButtonBox()
		vbbox.set_layout(gtk.BUTTONBOX_START)
		hbox.pack_start(vbbox, False)
		add_button = gtk.Button(stock='gtk-add')
		add_button.connect('clicked', self.do_add_notebook)
		#~ edit_button = gtk.Button(stock='gtk-edit')
		#~ edit_button.connect('clicked', self.do_edit_notebook)
		rm_button = gtk.Button(stock='gtk-remove')
		rm_button.connect('clicked', self.do_remove_notebook)
		#~ for b in (add_button, edit_button, rm_button):
		for b in (add_button, rm_button):
			b.set_alignment(0.0, 0.5)
			vbbox.add(b)
		# FIXME buttons for "up" and "down" ?

		# add dropdown to select default
		self.combobox = DefaultNotebookComboBox(self.treeview.get_model())

		# clear button de-selects any item in the combobox
		clear_button = IconButton('gtk-clear')
		clear_button.connect('clicked', lambda o: self.combobox.set_active(-1))

		hbox = gtk.HBox(spacing=5)
		hbox.pack_start(gtk.Label(_('Default notebook')+': '), False)
			# T: Input label in 'open notebook' dialog
		hbox.pack_start(self.combobox, False)
		hbox.pack_start(clear_button, False)
		self.vbox.pack_start(hbox, False)
コード例 #40
0
	def __init__(self, ui, type):
		Dialog.__init__(self, ui, _('Custom Command')) # T: Dialog title
		assert type in ('file_browser', 'web_browser', 'email_client')
		self.type = type
		self.add_fields(
			('name', 'string', _('Name'), ''), # T: Field in 'custom command' dialog
			('exec', 'string', _('Command'), ''), # T: Field in 'custom command' dialog
		)
コード例 #41
0
 def __init__(self, parent, plugin, pageview):
     Dialog.__init__(
         self,
         parent,
         _('Insert Symbol'),  # T: Dialog title
         button=_('_Insert'),  # T: Button label
         defaultwindowsize=(350, 400))
     self.plugin = plugin
コード例 #42
0
	def __init__(self, ui, default_tab=None, select_plugin=None):
		Dialog.__init__(self, ui, _('Preferences')) # T: Dialog title
		gtknotebook = gtk.Notebook()
		self.vbox.add(gtknotebook)
		# saves a list of loaded plugins to be used later
		self.p_save_loaded = [p.__class__ for p in self.ui.plugins]

		# Dynamic tabs
		self.forms = {}
		for category, preferences in ui.preferences_register.items():
			vbox = gtk.VBox()
			index = gtknotebook.append_page(vbox, gtk.Label(_(category)))
			# From GTK Doc: Note that due to historical reasons, GtkNotebook refuses
			# to switch to a page unless the child widget is visible.
			vbox.show()
			if category == default_tab: gtknotebook.set_current_page(index)

			fields = []
			values = {}
			sections = {}
			for p in preferences:
				if len(p) == 4:
					section, key, type, label = p
					fields.append((key, type, label))
				else:
					section, key, type, label, check = p
					fields.append((key, type, label, check))

				values[key] = ui.preferences[section][key]
				sections[key] = section

			form = InputForm(fields, values)
			form.preferences_sections = sections
			vbox.pack_start(form, False)
			self.forms[category] = form

			if category == 'Interface':
				self._add_font_selection(form)

		# Styles tab
		#~ gtknotebook.append_page(StylesTab(self), gtk.Label(_('Styles')))

		# Keybindings tab
		#~ gtknotebook.append_page(KeyBindingsTab(self), gtk.Label(_('Key bindings')))

		# Plugins tab
		plugins_tab = PluginsTab(self, self.ui.plugins)
		plugins_tab_index = gtknotebook.append_page(plugins_tab, gtk.Label(_('Plugins')))
				# T: Heading in preferences dialog
		plugins_tab.show()
		#~ print default_tab, index
		if default_tab == "Plugins":
			gtknotebook.set_current_page(plugins_tab_index)
			if not select_plugin is None:
					plugins_tab.select_plugin(select_plugin)

		# Applications tab
		gtknotebook.append_page(ApplicationsTab(self), gtk.Label(_('Applications')))
コード例 #43
0
ファイル: notebookdialog.py プロジェクト: thorhans/zimt
    def __init__(self, parent, callback=None):
        Dialog.__init__(self, parent, _('Open Notebook'))  # T: dialog title
        # TODO set button to "OPEN" instead of "OK"
        self.callback = callback
        self.set_default_size(500, 400)
        self.set_help(':Help:Notebooks')

        # show some art work in an otherwise boring dialog
        path = data_file('globe_banner_small.png').path
        image = Gtk.Image()
        image.set_from_file(path)  # new_from_file not in 2.6
        align = Gtk.Alignment.new(0, 0.5, 0, 0)
        align.add(image)
        self.vbox.pack_start(align, False, True, 0)

        # split between treeview and vbuttonbox
        hbox = Gtk.HBox(spacing=12)
        self.vbox.pack_start(hbox, True, True, 0)

        # add notebook list - open notebook on clicking a row
        self.treeview = NotebookTreeView()
        self.treeview.connect('row-activated',
                              lambda *a: self.response(Gtk.ResponseType.OK))

        hbox.add(ScrolledWindow(self.treeview))

        # add buttons for modifying the treeview
        vbbox = Gtk.VButtonBox()
        vbbox.set_layout(Gtk.ButtonBoxStyle.START)
        hbox.pack_start(vbbox, False, True, 0)
        add_button = Gtk.Button.new_with_mnemonic(_('_Add'))  # T: Button label
        add_button.connect('clicked', self.do_add_notebook)
        #~ edit_button = Gtk.Button.new_with_mnemonic(_('_Edit')) # T: Button label
        #~ edit_button.connect('clicked', self.do_edit_notebook)
        rm_button = Gtk.Button.new_with_mnemonic(
            _('_Remove'))  # T: Button label
        rm_button.connect('clicked', self.do_remove_notebook)
        #~ for b in (add_button, edit_button, rm_button):
        for b in (add_button, rm_button):
            b.set_alignment(0.0, 0.5)
            vbbox.add(b)
        # FIXME buttons for "up" and "down" ?

        # add dropdown to select default
        self.combobox = DefaultNotebookComboBox(self.treeview.get_model())

        # clear button de-selects any item in the combobox
        clear_button = IconButton('gtk-clear')
        clear_button.connect('clicked', lambda o: self.combobox.set_active(-1))

        hbox = Gtk.HBox(spacing=5)
        hbox.pack_start(Gtk.Label(_('Default notebook') + ': '), False, True,
                        0)
        # T: Input label in 'open notebook' dialog
        hbox.pack_start(self.combobox, False, True, 0)
        hbox.pack_start(clear_button, False, True, 0)
        self.vbox.pack_start(hbox, False, True, 0)
コード例 #44
0
    def __init__(self, window):
        Dialog.__init__(
            self,
            window,
            _('Search'),  # T: Dialog title
            buttons=gtk.BUTTONS_CLOSE,
            help='Help:Searching',
            defaultwindowsize=(400, 300))
        self.app_window = window

        hbox = gtk.HBox(spacing=5)
        self.vbox.pack_start(hbox, False)
        hbox.pack_start(gtk.Label(_('Search') + ': '), False)  # T: input label
        self.query_entry = InputEntry()
        hbox.add(self.query_entry)
        self.search_button = gtk.Button(stock=gtk.STOCK_FIND)
        hbox.pack_start(self.search_button, False)

        if gtk.gtk_version >= (2, 20) \
        and gtk.pygtk_version >= (2, 22): # update in pygtk was later
            self.spinner = gtk.Spinner()
            hbox.pack_start(self.spinner, False)
        else:
            self.spinner = None

        self.cancel_button = gtk.Button(stock=gtk.STOCK_STOP)
        hbox.pack_start(self.cancel_button, False)
        self._set_state(self.READY)

        help_text = _('For advanced search you can use operators like\n'
                      'AND, OR and NOT. See the help page for more details.'
                      )  # T: help text for the search dialog
        if gtk.gtk_version >= (2, 12) \
        and gtk.pygtk_version >= (2, 12):
            self.query_entry.set_tooltip_text(help_text)
        else:
            tooltips = gtk.Tooltips()
            tooltips.set_tip(self.query_entry, help_text)

        self.namespacecheckbox = gtk.CheckButton(
            _('Limit search to the current page and sub-pages'))
        # T: checkbox option in search dialog
        self.vbox.pack_start(self.namespacecheckbox, False)

        # TODO advanced query editor
        # TODO checkbox _('Match c_ase')
        # TODO checkbox _('Whole _word')

        self.results_treeview = SearchResultsTreeView(self.app_window)
        self.vbox.add(ScrolledWindow(self.results_treeview))

        self.search_button.connect_object('clicked', self.__class__._search,
                                          self)
        self.cancel_button.connect_object('clicked', self.__class__._cancel,
                                          self)
        self.query_entry.connect_object('activate', self.__class__._search,
                                        self)
コード例 #45
0
	def __init__(self, parent, page, callback):
		Dialog.__init__(self, parent, _('Jump to'), # T: Dialog title
			button=_('_Jump'), # T: Button label
		)
		self.callback = callback

		self.add_form(
			[('page', 'page', _('Jump to Page'), page)], # T: Label for page input
			notebook=parent.notebook
		)
コード例 #46
0
	def __init__(self, ui):
		Dialog.__init__(self, ui,
			_('Templates'), help='Help:Templates', buttons=gtk.BUTTONS_CLOSE,
			defaultwindowsize=(400, 450))
			# T: Dialog title

		label = gtk.Label()
		label.set_markup('<b>'+_('Templates')+'</b>')
			# T: Section in dialog
		label.set_alignment(0.0, 0.5)
		self.vbox.pack_start(label, False)

		hbox = gtk.HBox()
		self.vbox.add(hbox)

		self.view = TemplateListView()
		self.view.connect('row-activated', self.on_selection_changed)
		hbox.add(ScrolledWindow(self.view))

		vbbox = gtk.VButtonBox()
		vbbox.set_layout(gtk.BUTTONBOX_START)
		hbox.pack_start(vbbox, False)

		view_button = Button(stock='gtk-file', label=_('_View')) # T: button label
		view_button.connect('clicked', self.on_view)

		copy_button = Button(stock='gtk-copy')
		copy_button.connect('clicked', self.on_copy)

		edit_button = Button(stock='gtk-edit')
		edit_button.connect('clicked', self.on_edit)

		delete_button = gtk.Button(stock='gtk-remove')
		delete_button.connect('clicked', self.on_delete)

		for b in (view_button, copy_button, edit_button, delete_button):
			b.set_alignment(0.0, 0.5)
			vbbox.add(b)

		browse_button = Button(_('Browse')) # T: button label
		browse_button.connect('clicked', self.on_browse)
		self.add_extra_button(browse_button)

		self._buttonbox = vbbox
		self._delete_button = delete_button
		self.on_selection_changed()

		## Same button appears in export dialog
		if gtk.gtk_version >= (2, 10) \
		and gtk.pygtk_version >= (2, 10):
			url_button = gtk.LinkButton(
				'https://github.com/jaap-karssenberg/zim-wiki/wiki/Templates',
				_('Get more templates online') # T: label for button with URL
			)
			self.vbox.pack_start(url_button, False)
コード例 #47
0
	def __init__(self, ui):
		Dialog.__init__(self, ui, _('Recent Changes'), # T: Dialog title
			buttons=gtk.BUTTONS_CLOSE,
			defaultwindowsize=(400, 300)
		)

		self.treeview = RecentChangesTreeView(ui)
		self.vbox.add(ScrolledWindow(self.treeview))

		self.update()
		self.ui.notebook.connect_after('stored-page', lambda *a: self.update())
コード例 #48
0
    def __init__(self, widget, notebook, page, navigation):
        Dialog.__init__(
            self,
            widget,
            _('Search'),  # T: Dialog title
            buttons=Gtk.ButtonsType.CLOSE,
            help='Help:Searching',
            defaultwindowsize=(400, 300))
        self.page = page

        hbox = Gtk.HBox(spacing=5)
        self.vbox.pack_start(hbox, False, True, 0)
        search_label = Gtk.Label.new_with_mnemonic(_('_Search') + ': ')
        hbox.pack_start(search_label, False, True, 0)  # T: input label
        self.query_entry = InputEntry()
        hbox.add(self.query_entry)
        search_label.set_mnemonic_widget(self.query_entry)
        self.search_button = Gtk.Button.new_with_mnemonic(
            _('_Find'))  # T: Button label
        hbox.pack_start(self.search_button, False, True, 0)

        self.spinner = Gtk.Spinner()
        hbox.pack_start(self.spinner, False, True, 0)

        self.cancel_button = Gtk.Button.new_with_mnemonic(
            _('_Cancel'))  # T: Button label
        hbox.pack_start(self.cancel_button, False, True, 0)
        self._set_state(self.READY)

        help_text = _('For advanced search you can use operators like\n'
                      'AND, OR and NOT. See the help page for more details.'
                      )  # T: help text for the search dialog
        self.query_entry.set_tooltip_text(help_text)

        self.namespacecheckbox = Gtk.CheckButton.new_with_mnemonic(
            _('_Limit search to the current page and sub-pages'))
        # T: checkbox option in search dialog
        if page is not None:
            self.vbox.pack_start(self.namespacecheckbox, False, True, 0)

        # TODO advanced query editor
        # TODO checkbox _('Match c_ase')
        # TODO checkbox _('Whole _word')

        self.results_treeview = SearchResultsTreeView(notebook, navigation)
        self.vbox.pack_start(ScrolledWindow(self.results_treeview), True, True,
                             0)

        self.search_button.connect_object('clicked', self.__class__._search,
                                          self)
        self.cancel_button.connect_object('clicked', self.__class__._cancel,
                                          self)
        self.query_entry.connect_object('activate', self.__class__._search,
                                        self)
コード例 #49
0
	def __init__(self, ui, name=None, folder=None):
		Dialog.__init__(self, ui, self.title)
		if name is None and folder is None:
			name = 'Notes'
			folder = '~/Notes'
		if self.text:
			self.add_text(self.text)
		self.add_fields((
			('name', 'string', _('Name'), name), # T: input field in 'Add Notebook' dialog
			('folder', 'dir', _('Folder'), folder), # T: input field in 'Add Notebook' dialog
		))
コード例 #50
0
    def __init__(self, ui):
        Dialog.__init__(self, ui, _('Recent Changes'), # T: Dialog title
            buttons=gtk.BUTTONS_CLOSE,
            defaultwindowsize=(400, 300)
        )

        self.treeview = RecentChangesTreeView(ui)
        self.vbox.add(ScrolledWindow(self.treeview))

        self.update()
        self.ui.notebook.connect_after('stored-page', lambda *a: self.update())
コード例 #51
0
ファイル: quicknote.py プロジェクト: thejeshgn/Zim
	def __init__(self, ui, page=None, namespace=None, basename=None, append=None, text=None, template_options=None, attachments=None):
		Dialog.__init__(self, ui, _('Quick Note'))
		self._updating_title = False
		self._title_set_manually = not basename is None
		self.attachments = attachments

		self.uistate.setdefault('namespace', None, basestring)
		namespace = namespace or self.uistate['namespace']

		self.form = InputForm(notebook=self.ui.notebook)
		self.vbox.pack_start(self.form, False)
		self._init_inputs(namespace, basename, append, text, template_options)
コード例 #52
0
	def __init__(self, ui, title, generator, image=None, **opt):
		Dialog.__init__(self, ui, title, defaultwindowsize=(450, 300), **opt)
		self.generator = generator
		self.imagefile = None
		self.logfile = None
		self._existing_file = None

		self.vpane = gtk.VPaned()
		self.vpane.set_position(100)
		self.vbox.add(self.vpane)

		self.imageview = ImageView(bgcolor='#FFF', checkboard=False)
		# TODO scrolled window
		self.vpane.add1(self.imageview)

		self.textview = gtk.TextView()
		# TODO scrolled window
		# TODO supply at least an Undo stack for this textview
		# or optionally subclass from gtksourceview
		self.textview.set_left_margin(5)
		self.textview.set_right_margin(5)
		self.vpane.add2(self.textview)

		hbox = gtk.HBox(spacing=5)
		self.vbox.pack_start(hbox, False)

		self.previewbutton = Button(_('_Preview'), stock='gtk-refresh')
			# T: button in e.g. equation editor dialog
		self.previewbutton.set_sensitive(False)
		self.previewbutton.connect_object(
			'clicked', self.__class__.preview, self)
		hbox.pack_start(self.previewbutton, False)

		self.textview.get_buffer().connect('modified-changed',
			lambda b: self.previewbutton.set_sensitive(b.get_modified()))

		self.logbutton = Button(_('View _Log'), stock='gtk-file')
			# T: button in e.g. equation editor dialog
		self.logbutton.set_sensitive(False)
		self.logbutton.connect_object(
			'clicked', self.__class__.show_log, self)
		hbox.pack_start(self.logbutton, False)

		if image:
			file = image['_src_file'] # FIXME ?
			textfile = self._stitch_fileextension(file, self.generator.basename)
			if file.exists() and textfile.exists():
				self._existing_file = textfile
				self.imageview.set_file(file)
				self.set_text(textfile.read())

		self.textview.grab_focus()
コード例 #53
0
	def __init__(self, ui):
		Dialog.__init__(self, ui, _('Preferences')) # T: Dialog title
		gtknotebook = gtk.Notebook()
		self.vbox.add(gtknotebook)

		# Dynamic tabs
		for category, preferences in ui.preferences_register.items():
			table = gtk.Table()
			table.set_border_width(5)
			table.set_row_spacings(12)
			table.set_col_spacings(12)
			vbox = gtk.VBox()
			vbox.pack_start(table, False)
			gtknotebook.append_page(vbox, gtk.Label(category))
			fields = []
			for p in preferences:
				section, key, type, label = p
				value = ui.preferences[section][key]
				fields.append(((section, key), type, label, value))
				# a tuple is hashable and can be used as field name...
			self.add_fields(fields, table=table, trigger_response=False)
			if category == 'Interface':
				self._add_font_selection(table, vbox)

		# Styles tab
		#~ gtknotebook.append_page(StylesTab(self), gtk.Label('Styles'))

		# Keybindings tab
		#~ gtknotebook.append_page(KeyBindingsTab(self), gtk.Label('Key bindings'))

		# Applications tab
		table = gtk.Table()
		table.set_border_width(5)
		table.set_row_spacings(12)
		table.set_col_spacings(12)
		self.add_fields( (
			('file_browser', 'list', _('File browser'), (None, ())),
				# T: Input for application type in preferences dialog
			('web_browser', 'list', _('Web browser'), (None, ())),
				# T: Input for application type in preferences dialog
			('email_client', 'list', _('Email client'), (None, ())),
				# T: Input for application type in preferences dialog
		), table=table, trigger_response=False)
		for type in ('file_browser', 'web_browser', 'email_client'):
			self._append_applications(type)
		vbox = gtk.VBox()
		vbox.pack_start(table, False)
		gtknotebook.append_page(vbox, gtk.Label(_('Applications')))
				# T: Heading in preferences dialog

		# Plugins tab
		gtknotebook.append_page(PluginsTab(self), gtk.Label(_('Plugins')))
コード例 #54
0
	def __init__(self, ui):
		Dialog.__init__(self, ui, _('Search'), # T: Dialog title
			buttons=gtk.BUTTONS_CLOSE, help='Help:Searching',
			defaultwindowsize=(400, 300)
		)

		hbox = gtk.HBox(spacing=5)
		self.vbox.pack_start(hbox, False)
		hbox.pack_start(gtk.Label(_('Search')+': '), False) # T: input label
		self.query_entry = InputEntry()
		hbox.add(self.query_entry)
		self.search_button = gtk.Button(stock=gtk.STOCK_FIND)
		hbox.pack_start(self.search_button, False)

		if gtk.gtk_version >= (2, 20) \
		and gtk.pygtk_version >= (2, 22): # update in pygtk was later
			self.spinner = gtk.Spinner()
			hbox.pack_start(self.spinner, False)
		else:
			self.spinner = None

		self.cancel_button = gtk.Button(stock=gtk.STOCK_STOP)
		hbox.pack_start(self.cancel_button, False)
		self._set_state(self.READY)

		help_text = _(
			'For advanced search you can use operators like\n'
			'AND, OR and NOT. See the help page for more details.'
		) # T: help text for the search dialog
		if gtk.gtk_version >= (2, 12) \
		and gtk.pygtk_version >= (2, 12):
			self.query_entry.set_tooltip_text(help_text)
		else:
			tooltips = gtk.Tooltips()
			tooltips.set_tip(self.query_entry, help_text)

		self.namespacecheckbox = gtk.CheckButton(_('Limit search to the current page and sub-pages'))
			# T: checkbox option in search dialog
		self.vbox.pack_start(self.namespacecheckbox, False)

		# TODO advanced query editor
		# TODO checkbox _('Match c_ase')
		# TODO checkbox _('Whole _word')

		self.results_treeview = SearchResultsTreeView(self.ui)
		self.vbox.add(ScrolledWindow(self.results_treeview))

		self.search_button.connect_object('clicked', self.__class__._search, self)
		self.cancel_button.connect_object('clicked', self.__class__._cancel, self)
		self.query_entry.connect_object('activate', self.__class__._search, self)
コード例 #55
0
ファイル: scrot.py プロジェクト: damiansimanuk/texslide
	def __init__(self, ui):
		Dialog.__init__(self, ui, _('Insert Screenshot')) # T: dialog title
		self.screen_radio = gtk.RadioButton(None, _('Capture whole screen')) # T: option in 'insert screenshot' dialog
		self.select_radio = gtk.RadioButton(self.screen_radio, _('Select window or region')) # T: option in 'insert screenshot' dialog
		self.vbox.add(self.screen_radio)
		self.vbox.add(self.select_radio)

		hbox = gtk.HBox()
		self.vbox.add(hbox)
		hbox.add(gtk.Label(_('Delay')+': ')) # T: input in 'insert screenshot' dialog
		self.time_spin = gtk.SpinButton()
		self.time_spin.set_range(0, 99)
		self.time_spin.set_increments(1, 5)
		hbox.add(self.time_spin)
		hbox.add(gtk.Label(' '+_('seconds'))) # T: label behind timer
コード例 #56
0
ファイル: applications.py プロジェクト: DarioGT/Zim-QDA
 def __init__(self, ui, mimetype):
     '''Constructor
     @param ui: the parent window or C{GtkInterface} object
     @param mimetype: mime-type for which we want to create a new
     application
     '''
     Dialog.__init__(self, ui, _('Add Application')) # T: Dialog title
     self.mimetype = mimetype
     self.add_text(_mimetype_dialog_text(mimetype))
     self.add_form( (
         ('name', 'string', _('Name')), # T: Field in 'custom command' dialog
         ('exec', 'string', _('Command')), # T: Field in 'custom command' dialog
         ('default', 'bool', _('Make default application')), # T: Field in 'custom command' dialog
     ) )
     self.form['default'] = True
コード例 #57
0
	def __init__(self, ui):
		Dialog.__init__(self, ui, _('Properties')) # T: Dialog title
		label = gtk.Label()
		label.set_markup('<b>'+_('Notebook Properties')+'</b>')
			# T: Section in notbook dialog
		label.set_alignment(0.0, 0.5)
		self.vbox.pack_start(label, False)
		fields = []
		config = self.ui.notebook.config['Notebook']
		for name, type, label in self.ui.notebook.properties:
			fields.append((name, type, label, config[name]))
		self.add_fields(fields)
		if self.ui.readonly:
			for widget in self.inputs.values():
				widget.set_sensitive(False)
コード例 #58
0
ファイル: calendar.py プロジェクト: thejeshgn/Zim
	def __init__(self, plugin):
		Dialog.__init__(self, plugin.ui, _('Calendar'), buttons=gtk.BUTTONS_CLOSE) # T: dialog title
		self.set_resizable(False)
		self.plugin = plugin

		self.calendar_widget = CalendarPluginWidget(plugin)
		self.calendar_widget.set_select_date_callback(self.on_select_date)
		self.vbox.add(self.calendar_widget)

		button = Button(_('_Today'), gtk.STOCK_JUMP_TO) # T: button label
		button.connect('clicked', self.do_today )
		self.action_area.add(button)
		self.action_area.reorder_child(button, 0)
		self.dateshown = datetime.date.today()

		self.connectto(self.plugin.ui, 'open-page')
コード例 #59
0
ファイル: propertiesdialog.py プロジェクト: DarioGT/Zim-QDA
 def __init__(self, ui):
     Dialog.__init__(self, ui, _('Properties'), help='Help:Properties') # T: Dialog title
     label = gtk.Label()
     label.set_markup('<b>'+_('Notebook Properties')+'</b>')
         # T: Section in notebook dialog
     label.set_alignment(0.0, 0.5)
     self.vbox.pack_start(label, False)
     fields = []
     config = self.ui.notebook.config['Notebook']
     for item in self.ui.notebook.properties:
         fields.append(item)
     self.add_form(fields, values=config)
     self.form.widgets['icon'].set_use_relative_paths(self.ui.notebook)
     if self.ui.readonly:
         for widget in self.form.widgets.values():
             widget.set_sensitive(False)
コード例 #60
0
ファイル: sourceview.py プロジェクト: gdw2/zim
	def __init__(self, ui):
		Dialog.__init__(self, ui, _('Insert Code Block')) # T: dialog title
		names = sorted(LANGUAGES, key=lambda k: k.lower())
		self.add_form(
			(('lang', 'choice', _('Syntax'), names),) # T: input label
		)

		# Set previous used language
		if 'lang' in self.uistate:
			for name, id in LANGUAGES.items():
				if self.uistate['lang'] == id:
					try:
						self.form['lang'] = name
					except ValueError:
						pass

					break