当前位置: 首页>>代码示例>>Python>>正文


Python widgets.Dialog类代码示例

本文整理汇总了Python中zim.gui.widgets.Dialog的典型用法代码示例。如果您正苦于以下问题:Python Dialog类的具体用法?Python Dialog怎么用?Python Dialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Dialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

	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)
开发者ID:thejeshgn,项目名称:Zim,代码行数:34,代码来源:quicknote.py

示例2: __init__

	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)
开发者ID:fabricehong,项目名称:zim-desktop,代码行数:25,代码来源:preferencesdialog.py

示例3: __init__

    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)
开发者ID:DarioGT,项目名称:Zim-QDA,代码行数:28,代码来源:__init__.py

示例4: __init__

	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)
开发者ID:thejeshgn,项目名称:Zim,代码行数:35,代码来源:cleannotebookdialog.py

示例5: __init__

    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)
开发者ID:DarioGT,项目名称:Zim-QDA,代码行数:35,代码来源:customtools.py

示例6: __init__

    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()
开发者ID:DarioGT,项目名称:Zim-QDA,代码行数:28,代码来源:insertsymbol.py

示例7: __init__

    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()
开发者ID:Pl-M,项目名称:zim-icontags-plugin,代码行数:32,代码来源:tagsmanager.py

示例8: __init__

    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)
开发者ID:Jam71,项目名称:Zim-QDA,代码行数:32,代码来源:gui.py

示例9: __init__

	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)
开发者ID:damiansimanuk,项目名称:texslide,代码行数:34,代码来源:searchdialog.py

示例10: __init__

	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)
开发者ID:gdw2,项目名称:zim,代码行数:26,代码来源:linkmap.py

示例11: __init__

    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()
开发者ID:DarioGT,项目名称:Zim-QDA,代码行数:26,代码来源:applications.py

示例12: __init__

    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)
开发者ID:DarioGT,项目名称:Zim-QDA,代码行数:60,代码来源:qdaCodesDialog.py

示例13: __init__

	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()
开发者ID:wiwie,项目名称:zim_tableeditor,代码行数:25,代码来源:tableeditor.py

示例14: __init__

	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)
开发者ID:damiansimanuk,项目名称:texslide,代码行数:59,代码来源:notebookdialog.py

示例15: __init__

	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
		)
开发者ID:damiansimanuk,项目名称:texslide,代码行数:8,代码来源:applications.py


注:本文中的zim.gui.widgets.Dialog类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。