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


Python Gtk.Notebook方法代码示例

本文整理汇总了Python中gi.repository.Gtk.Notebook方法的典型用法代码示例。如果您正苦于以下问题:Python Gtk.Notebook方法的具体用法?Python Gtk.Notebook怎么用?Python Gtk.Notebook使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gi.repository.Gtk的用法示例。


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

示例1: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Notebook [as 别名]
def __init__(self, win):

        Gtk.Notebook.__init__(self)

        background = Gtk.EventBox()
        background.add(self)

        self.win = win
        self.win.set_main_widget(background)
        self.win.top_bar.enable_prev()
        self.win.change_prev_callback(self.win.go_to_home)

        # Modify set_wallpaper so it doesn't add itself to the window
        wallpaper_widget = SetWallpaper(self.win)
        screensaver_widget = SetScreensaver(self.win)
        reset_widget = SetResetDesktop(self.win)

        wallpaper_label = Gtk.Label(_("BACKGROUND"))
        wallpaper_label_ebox = Gtk.EventBox()
        wallpaper_label_ebox.add(wallpaper_label)
        wallpaper_label_ebox.connect('realize', self._set_cursor_to_hand_cb)
        wallpaper_label_ebox.show_all()

        screensaver_label = Gtk.Label(_("SCREENSAVER"))
        screensaver_label_ebox = Gtk.EventBox()
        screensaver_label_ebox.add(screensaver_label)
        screensaver_label_ebox.connect('realize', self._set_cursor_to_hand_cb)
        screensaver_label_ebox.show_all()

        general_label = Gtk.Label(_("GENERAL"))
        general_label_ebox = Gtk.EventBox()
        general_label_ebox.add(general_label)
        general_label_ebox.connect('realize', self._set_cursor_to_hand_cb)
        general_label_ebox.show_all()

        # Add the screensaver and wallpaper tabs
        self.append_page(wallpaper_widget, wallpaper_label_ebox)
        self.append_page(screensaver_widget, screensaver_label_ebox)
        self.append_page(reset_widget, general_label_ebox)

        self.win.show_all() 
开发者ID:KanoComputing,项目名称:kano-settings,代码行数:43,代码来源:set_style.py

示例2: build_widget

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Notebook [as 别名]
def build_widget(self):
        """
        Builds the interface and returns a Gtk.Container type that
        contains the interface. This containter will be inserted into
        a Gtk.Notebook page.
        """
        self.box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=4)
        #top widget at the top
        self.box.pack_start(self.top_widget(), False, False, 0 )
        #web page under it in a scrolled window
        self.toolkit = TOOLKIT = get_toolkits()
        self.renderer = RendererWebkit()
        self.frames = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=4)
        frame = Gtk.ScrolledWindow(hadjustment=None, vadjustment=None)
        frame.set_shadow_type(Gtk.ShadowType.NONE)
        frame.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        frame.add(self.renderer.get_window())
        self.frames.set_homogeneous(False)
        self.frames.pack_start(frame, True, True, 0)
        self.frames.pack_end(self.filter, False, False, 0)
        self.box.pack_start(self.frames, True, True, 0)
        # this is used to activate the back and forward button
        # from the renderer class.
        self.renderer.fct = lambda: self.set_button_sensitivity
        self.renderer.show_all()
        self.filter.hide()
        #load a welcome html page
        urlhelp = self._create_start_page()
        self.open(urlhelp)
        return self.box 
开发者ID:gramps-project,项目名称:addons-source,代码行数:32,代码来源:htmlview.py

示例3: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Notebook [as 别名]
def __init__(self):
        View.__init__(self)
        self.notebook = Gtk.Notebook()
        self.notebook.set_scrollable(True)
        self.notebook.set_name('states_editor_notebook')
        self.notebook.get_style_context().add_class("secondary")
        self.notebook.show()

        self.notebook.connect("button_press_event", self.button_released)

        self['notebook'] = self.notebook
        self.top = 'notebook' 
开发者ID:DLR-RM,项目名称:RAFCON,代码行数:14,代码来源:states_editor.py

示例4: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Notebook [as 别名]
def __init__(self):
        View.__init__(self)
        self.notebook = Gtk.Notebook()
        self.notebook.set_scrollable(True)
        self.notebook.set_name("state_machines_notebook")
        self.notebook.get_style_context().add_class("secondary")
        self.notebook.show()

        self['notebook'] = self.notebook
        self.top = 'notebook' 
开发者ID:DLR-RM,项目名称:RAFCON,代码行数:12,代码来源:state_machines_editor.py

示例5: _init

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Notebook [as 别名]
def _init(cls):
        cls.tagToIter = {}
        cls.tagToPage = {}
        cls.pathToPage = {}
        cls.tagToTime = {}

        cls.window = Gtk.Window()
        cls.window.set_title(_("PyChess Information Window"))
        cls.window.set_border_width(12)
        cls.window.set_icon_name("pychess")
        uistuff.keepWindowSize("logdialog", cls.window, (640, 480))
        mainHBox = Gtk.HBox()
        mainHBox.set_spacing(6)
        cls.window.add(mainHBox)

        sw = Gtk.ScrolledWindow()
        sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        sw.set_shadow_type(Gtk.ShadowType.IN)
        mainHBox.pack_start(sw, False, True, 0)
        cls.treeview = Gtk.TreeView(Gtk.TreeStore(str))
        cls.treeview.append_column(Gtk.TreeViewColumn("",
                                                      Gtk.CellRendererText(),
                                                      text=0))
        cls.treeview.set_headers_visible(False)
        cls.treeview.get_selection().set_mode(Gtk.SelectionMode.BROWSE)
        sw.add(cls.treeview)
        cls.pages = Gtk.Notebook()
        cls.pages.set_show_tabs(False)
        cls.pages.set_show_border(False)
        mainHBox.pack_start(cls.pages, True, True, 0)

        mainHBox.show_all()

        def selectionChanged(selection):
            treestore, iter = selection.get_selected()
            if iter:
                child = cls.pathToPage[treestore.get_path(iter).to_string()][
                    "child"]
                cls.pages.set_current_page(cls.pages.page_num(child))

        cls.treeview.get_selection().connect("changed", selectionChanged) 
开发者ID:pychess,项目名称:pychess,代码行数:43,代码来源:LogDialog.py

示例6: new_notebook

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Notebook [as 别名]
def new_notebook(name=None):
    def customGetTabLabelText(child):
        return name

    notebook = Gtk.Notebook()
    if name is not None:
        notebook.set_name(name)
    notebook.get_tab_label_text = customGetTabLabelText
    notebook.set_show_tabs(False)
    notebook.set_show_border(False)
    return notebook 
开发者ID:pychess,项目名称:pychess,代码行数:13,代码来源:__init__.py

示例7: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Notebook [as 别名]
def __init__(self, name=None):
        Gtk.Notebook.__init__(self)
        if name is not None:
            self.set_name(name)
        self.get_tab_label_text = self.customGetTabLabelText
        self.set_show_tabs(False) 
开发者ID:pychess,项目名称:pychess,代码行数:8,代码来源:InfoBar.py

示例8: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Notebook [as 别名]
def __init__(self, app, gladefile, title):
		GObject.GObject.__init__(self)
		self.app = app
		self.config = None
		self._loading = False
		self.values = None
		self.checks = {}
		# Stores original label  value while error message is displayed.
		self.original_labels={}
		# Used by get_widget_id
		self.widget_to_id = {}
		self.setup_widgets(gladefile, title)
		# Move entire dialog content to ScrolledWindow if screen height
		# is too small
		if Gdk.Screen.get_default().height() < 900:
			if not self["editor-content"] is None:
				parent = self["editor-content"].get_parent()
				if isinstance(parent, Gtk.Notebook):
					order, labels = [], {}
					for c in [] + parent.get_children():
						labels[c] = parent.get_tab_label(c)
						order.append(c)
						parent.remove(c)
					for c in order:
						sw = Gtk.ScrolledWindow()
						sw.add_with_viewport(c)
						parent.append_page(sw, labels[c])
				else:
					sw = Gtk.ScrolledWindow()
					parent.remove(self["editor-content"])
					sw.add_with_viewport(self["editor-content"])
					parent.pack_start(sw, True, True, 0)
				self["editor"].resize(self["editor"].get_size()[0], Gdk.Screen.get_default().height() * 2 / 3) 
开发者ID:kozec,项目名称:syncthing-gtk,代码行数:35,代码来源:editordialog.py

示例9: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Notebook [as 别名]
def __init__(self):
        Gtk.Window.__init__(self, title='Battery Monitor')
        self.set_default_size(800, 400)
        self.set_resizable(True)
        self.set_border_width(0)
        self.get_focus()
        self.set_position(Gtk.WindowPosition.CENTER)
        self.set_default_icon_from_file(ICONS['app'])
        self.config_dir = os.path.dirname(CONFIG_FILE)
        self.config = configparser.ConfigParser()
        self.__load_config()

        self.notebook = Gtk.Notebook()
        self.add(self.notebook)
        self.notebook.append_page(self.__configuration_page(), Gtk.Label('Configuration')) 
开发者ID:maateen,项目名称:battery-monitor,代码行数:17,代码来源:SettingsWindow.py

示例10: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Notebook [as 别名]
def __init__(self):
        Gtk.Notebook.__init__(self, vexpand=True, vexpand_set=True, valign=1, expand=True)

        ###############
        ### Project ###
        ###############
        self.project_contents = Gtk.VBox(vexpand=True, valign=0, vexpand_set=True, expand=True)
        sw1 = Gtk.ScrolledWindow(vexpand=True, valign=0, vexpand_set=True, expand=True)
        sw1.add_with_viewport(self.project_contents)
        self.project_page_num = self.append_page(sw1, Gtk.Label("Project"))

        ################
        ### Selected ###
        ################
        self.selected_contents = Gtk.VBox()
        sw2 = Gtk.ScrolledWindow()
        sw2.add_with_viewport(self.selected_contents)
        self.selected_page_num = self.append_page(sw2, Gtk.Label("Selected"))

        ###############
        ### Options ###
        ###############
        self.options_contents_super = Gtk.VBox()
        sw3 = Gtk.ScrolledWindow()
        sw3.add_with_viewport(self.options_contents_super)
        self.options_page_num = self.append_page(sw3, Gtk.Label("Options"))

        hb = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        ico = Gtk.Image.new_from_file("share/gear32.png")
        hb.pack_start(ico, expand=False, fill=False, padding=0)
        self.combo_options = Gtk.ComboBoxText()
        hb.pack_start(self.combo_options, expand=True, fill=True, padding=0)
        self.options_contents_super.pack_start(hb, expand=False, fill=False, padding=0)
        self.options_contents = Gtk.VBox()
        self.options_contents_super.pack_start(self.options_contents, expand=False, fill=False, padding=0)

        ############
        ### Tool ###
        ############
        self.tool_contents = Gtk.VBox()
        self.tool_page_num = self.append_page(self.tool_contents, Gtk.Label("Tool")) 
开发者ID:Denvi,项目名称:FlatCAM,代码行数:43,代码来源:FCNoteBook.py

示例11: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Notebook [as 别名]
def __init__(self, inputs=None, values=None, depends=None, notebook=None):
		'''Constructor.

		@param inputs: list with input definitions, see L{add_inputs()}
		for details
		@param values: initial values for the inputs
		@param depends: dict with dependencies between widgets, see
		L{depends()} for details
		@param notebook: a L{Notebook} object, e.g. for completion in
		L{PageEntry} inputs
		'''
		GObject.GObject.__init__(self)
		self.set_border_width(5)
		self.set_row_spacings(5)
		self.set_col_spacings(12)

		self.notebook = notebook
		self._input_valid = True
		self._keys = [] # names of options - radiogroups are represented as a single item
		self.widgets = {} # all widgets - contains individual radiobuttons
		self._widgets = [] # sequence for widgets in self.widgets

		self._default_activate = None

		if inputs:
			self.add_inputs(inputs)

		if depends:
			for k, v in list(depends.items()):
				self.depends(k, v)

		if values:
			self.update(values) 
开发者ID:zim-desktop-wiki,项目名称:zim-desktop-wiki,代码行数:35,代码来源:widgets.py

示例12: set_use_relative_paths

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Notebook [as 别名]
def set_use_relative_paths(self, notebook, path=None):
		'''Set the notebook and path to be used for relative paths.

		@param notebook: the L{Notebook} object for resolving paths
		or C{None} to disable relative paths.
		@param path: a L{Path} object used for resolving relative links
		'''
		self.notebook = notebook
		self.notebookpath = path 
开发者ID:zim-desktop-wiki,项目名称:zim-desktop-wiki,代码行数:11,代码来源:widgets.py

示例13: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Notebook [as 别名]
def __init__(self, parent, application):
		"""
		:param parent: The parent window for this object.
		:type parent: :py:class:`Gtk.Window`
		:param application: The main client application instance.
		:type application: :py:class:`Gtk.Application`
		"""
		super(MailSenderTab, self).__init__()
		self.parent = parent
		self.application = application
		self.config = application.config
		self.box = Gtk.Box()
		self.box.set_property('orientation', Gtk.Orientation.VERTICAL)
		self.box.show()
		self.label = Gtk.Label(label='Send Messages')
		"""The :py:class:`Gtk.Label` representing this tabs name."""

		self.notebook = Gtk.Notebook()
		""" The :py:class:`Gtk.Notebook` for holding sub-tabs."""
		self.notebook.connect('switch-page', self.signal_notebook_switch_page)
		self.notebook.set_scrollable(True)
		self.box.pack_start(self.notebook, True, True, 0)

		self.status_bar = Gtk.Statusbar()
		self.status_bar.show()
		self.box.pack_end(self.status_bar, False, False, 0)

		self.tabs = utilities.FreezableDict()
		"""A dict object holding the sub tabs managed by this object."""
		current_page = self.notebook.get_current_page()
		self.last_page_id = current_page

		config_tab = MailSenderConfigurationTab(self.application)
		self.tabs['config'] = config_tab
		self.notebook.append_page(config_tab.box, config_tab.label)

		edit_tab = MailSenderEditTab(self.application)
		self.tabs['edit'] = edit_tab
		self.notebook.append_page(edit_tab.box, edit_tab.label)

		preview_tab = MailSenderPreviewTab(self.application)
		self.tabs['preview'] = preview_tab
		self.notebook.append_page(preview_tab.box, preview_tab.label)

		send_messages_tab = MailSenderSendTab(self.application)
		self.tabs['send_messages'] = send_messages_tab
		self.notebook.append_page(send_messages_tab.box, send_messages_tab.label)

		self.tabs.freeze()
		for tab in self.tabs.values():
			tab.box.show()
		self.notebook.show()

		self.application.connect('campaign-set', self.signal_kpc_campaign_set) 
开发者ID:rsmusllp,项目名称:king-phisher,代码行数:56,代码来源:mail.py

示例14: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Notebook [as 别名]
def __init__(self, parent, application):
		"""
		:param parent: The parent window for this object.
		:type parent: :py:class:`Gtk.Window`
		:param application: The main client application instance.
		:type application: :py:class:`Gtk.Application`
		"""
		self.parent = parent
		self.application = application
		self.config = application.config
		self.logger = logging.getLogger('KingPhisher.Client.' + self.__class__.__name__)
		self.box = Gtk.Box()
		self.box.set_property('orientation', Gtk.Orientation.VERTICAL)
		self.box.show()
		self.label = Gtk.Label(label='View Campaign')
		"""The :py:class:`Gtk.Label` representing this tabs name."""

		self.notebook = Gtk.Notebook()
		""" The :py:class:`Gtk.Notebook` for holding sub-tabs."""
		self.notebook.connect('switch-page', self.signal_notebook_switch_page)
		self.notebook.set_scrollable(True)
		self.box.pack_start(self.notebook, True, True, 0)

		self.tabs = utilities.FreezableDict()
		"""A dict object holding the sub tabs managed by this object."""
		current_page = self.notebook.get_current_page()
		self.last_page_id = current_page

		if graphs.has_matplotlib:
			self.logger.info('matplotlib is installed, dashboard will be available')
			dashboard_tab = CampaignViewDashboardTab(application)
			self.tabs['dashboard'] = dashboard_tab
			self.notebook.append_page(dashboard_tab.box, dashboard_tab.label)
		else:
			self.logger.warning('matplotlib is not installed, dashboard will not be available')

		messages_tab = CampaignViewMessagesTab(application)
		self.tabs['messages'] = messages_tab
		self.notebook.append_page(messages_tab.box, messages_tab.label)

		visits_tab = CampaignViewVisitsTab(application)
		self.tabs['visits'] = visits_tab
		self.notebook.append_page(visits_tab.box, visits_tab.label)

		credentials_tab = CampaignViewCredentialsTab(application)
		self.tabs['credentials'] = credentials_tab
		self.notebook.append_page(credentials_tab.box, credentials_tab.label)

		if self.config.get('gui.show_deaddrop', False):
			deaddrop_connections_tab = CampaignViewDeaddropTab(application)
			self.tabs['deaddrop_connections'] = deaddrop_connections_tab
			self.notebook.append_page(deaddrop_connections_tab.box, deaddrop_connections_tab.label)

		self.tabs.freeze()
		for tab in self.tabs.values():
			tab.box.show()
		self.notebook.show() 
开发者ID:rsmusllp,项目名称:king-phisher,代码行数:59,代码来源:campaign.py

示例15: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Notebook [as 别名]
def __init__(self, dbstate, user, options_class, name, callback=None):
        uistate = user.uistate

        tool.Tool.__init__(self, dbstate, options_class, name)

        self.window_name = _('Media Verify Tool')
        ManagedWindow.__init__(self, uistate, [], self.__class__)

        self.dbstate = dbstate
        self.moved_files = []
        self.titles = [_('Moved/Renamed Files'), _('Missing Files'),
                       _('Duplicate Files'), _('Extra Files'),
                       _('No md5 Generated'), _('Errors')]
        self.models = []
        self.views = []

        window = Gtk.Window()
        vbox = Gtk.VBox()

        self.notebook = Gtk.Notebook()
        self.notebook.set_scrollable(True)
        for title in self.titles:
            self.create_tab(title)
        vbox.pack_start(self.notebook, True, True, 5)

        bbox = Gtk.HButtonBox()
        vbox.pack_start(bbox, False, False, 5)
        close = Gtk.Button(_('Close'))
        close.set_tooltip_text(_('Close the Media Verify Tool'))
        close.connect('clicked', self.close)
        generate = Gtk.Button(_('Generate'))
        generate.set_tooltip_text(_('Generate md5 hashes for media objects'))
        generate.connect('clicked', self.generate_md5)
        verify = Gtk.Button(_('Verify'))
        verify.set_tooltip_text(_('Check media paths and report missing, '
                                  'duplicate and extra files'))
        verify.connect('clicked', self.verify_media)
        export = Gtk.Button(_('Export'))
        export.set_tooltip_text(_('Export the results to a text file'))
        export.connect('clicked', self.export_results)
        fix = Gtk.Button(_('Fix'))
        fix.set_tooltip_text(_('Fix media paths of moved and renamed files'))
        fix.connect('clicked', self.fix_media)
        bbox.add(close)
        bbox.add(generate)
        bbox.add(verify)
        bbox.add(export)
        bbox.add(fix)
        vbox.show_all()

        window.add(vbox)
        window.set_size_request(500, 300)
        window.set_position(Gtk.WindowPosition.CENTER_ON_PARENT)
        self.set_window(window, None, self.window_name)
        self.show()

        self.show_tabs() 
开发者ID:gramps-project,项目名称:addons-source,代码行数:59,代码来源:MediaVerify.py


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