Python gi.repository.Gtk.Notebook() Examples
The following are 20
code examples of gi.repository.Gtk.Notebook().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
gi.repository.Gtk
, or try the search function
.
Example #1
Source File: widgets.py From zim-desktop-wiki with GNU General Public License v2.0 | 5 votes |
def __init__(self, notebook, path=None): '''Constructor @param notebook: the L{Notebook} object for resolving paths and completing existing pages, but allowed to be C{None} e.g. for testing @param path: a L{Path} object used for resolving relative links ''' PageEntry.__init__(self, notebook, path) self.action = Gtk.FileChooserAction.OPEN self.file_type_hint = None
Example #2
Source File: set_style.py From kano-settings with GNU General Public License v2.0 | 5 votes |
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()
Example #3
Source File: widgets.py From zim-desktop-wiki with GNU General Public License v2.0 | 5 votes |
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 and completing existing pages, or C{None} to disable relative paths. @param path: a L{Path} object used for resolving relative links ''' self.notebook = notebook self.notebookpath = path
Example #4
Source File: htmlview.py From addons-source with GNU General Public License v2.0 | 5 votes |
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
Example #5
Source File: states_editor.py From RAFCON with Eclipse Public License 1.0 | 5 votes |
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'
Example #6
Source File: state_machines_editor.py From RAFCON with Eclipse Public License 1.0 | 5 votes |
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'
Example #7
Source File: widgets.py From zim-desktop-wiki with GNU General Public License v2.0 | 5 votes |
def __init__(self, notebook, path=None, subpaths_only=False, existing_only=False): '''Constructor @param notebook: the L{Notebook} object for resolving paths and completing existing pages, but allowed to be C{None} e.g. for testing @param path: a L{Path} object used for resolving relative links @param subpaths_only: if C{True} the input will always be considered a child 'C{path}' @param existing_only: if C{True} only allow to select existing pages @note: 'C{subpaths_only}' and 'C{existing_only}' can also be set using the like named attributes ''' self.notebook = notebook self.notebookpath = path self.subpaths_only = subpaths_only self.existing_only = existing_only if self._allow_select_root: placeholder_text = _('<Top>') # T: default text for empty page section selection else: placeholder_text = None InputEntry.__init__(self, allow_empty=self._allow_select_root, placeholder_text=placeholder_text) assert path is None or isinstance(path, Path) completion = Gtk.EntryCompletion() completion.set_model(Gtk.ListStore(str, str)) # visible name, match name completion.set_text_column(0) self.set_completion(completion) self.connect_after('changed', self.__class__.update_completion)
Example #8
Source File: LogDialog.py From pychess with GNU General Public License v3.0 | 5 votes |
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)
Example #9
Source File: __init__.py From pychess with GNU General Public License v3.0 | 5 votes |
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
Example #10
Source File: widgets.py From zim-desktop-wiki with GNU General Public License v2.0 | 5 votes |
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
Example #11
Source File: InfoBar.py From pychess with GNU General Public License v3.0 | 5 votes |
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)
Example #12
Source File: editordialog.py From syncthing-gtk with GNU General Public License v2.0 | 5 votes |
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)
Example #13
Source File: SettingsWindow.py From battery-monitor with GNU General Public License v3.0 | 5 votes |
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'))
Example #14
Source File: FCNoteBook.py From FlatCAM with MIT License | 5 votes |
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"))
Example #15
Source File: widgets.py From zim-desktop-wiki with GNU General Public License v2.0 | 5 votes |
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)
Example #16
Source File: PyDockLeaf.py From pychess with GNU General Public License v3.0 | 4 votes |
def __init__(self, widget, title, id, perspective): TabReceiver.__init__(self, perspective) self.perspective = perspective self.set_no_show_all(True) self.book = Gtk.Notebook() self.book.set_name(id) self.book_cids = [ self.book.connect("drag-begin", self.__onDragBegin), self.book.connect("drag-end", self.__onDragEnd), self.book.connect_after("switch-page", self.__onPageSwitched), ] self.add(self.book) self.book.show() self.highlightArea = HighlightArea(self) self.button_cids = [] self.starButton = StarArrowButton( self, addDataPrefix("glade/dock_top.svg"), addDataPrefix("glade/dock_right.svg"), addDataPrefix("glade/dock_bottom.svg"), addDataPrefix("glade/dock_left.svg"), addDataPrefix("glade/dock_center.svg"), addDataPrefix("glade/dock_star.svg")) self.button_cids += [ self.starButton.connect("dropped", self.__onDrop), self.starButton.connect("hovered", self.__onHover), self.starButton.connect("left", self.__onLeave), ] self.dockable = True self.panels = [] self.zoomPointer = Gtk.Label() self.realtop = None self.zoomed = False # assert isinstance(widget, Gtk.Notebook) self.__add(widget, title, id)
Example #17
Source File: mail.py From king-phisher with BSD 3-Clause "New" or "Revised" License | 4 votes |
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)
Example #18
Source File: ChatPanel.py From pychess with GNU General Public License v3.0 | 4 votes |
def load(self, widgets, connection, lounge): self.connection = connection # deferred imports to not slow down PyChess starting up from pychess.widgets.ViewsPanel import ViewsPanel from pychess.widgets.InfoPanel import InfoPanel from pychess.widgets.ChannelsPanel import ChannelsPanel self.viewspanel = ViewsPanel(self.connection) self.channelspanel = ChannelsPanel(self.connection) self.adj = self.channelspanel.get_vadjustment() self.infopanel = InfoPanel(self.connection) self.chatbox = Gtk.Paned() __widget__ = self.chatbox self.chatbox.add1(self.channelspanel) notebook = Gtk.Notebook() notebook.append_page(self.viewspanel, Gtk.Label(_("Chat"))) notebook.append_page(self.infopanel, Gtk.Label(_("Info"))) self.chatbox.add2(notebook) self.panels = [self.viewspanel, self.channelspanel, self.infopanel] self.viewspanel.connect('channel_content_Changed', self.channelspanel.channel_Highlight, id) self.channelspanel.connect('conversationAdded', self.onConversationAdded) self.channelspanel.connect('conversationRemoved', self.onConversationRemoved) self.channelspanel.connect('conversationSelected', self.onConversationSelected) self.channelspanel.connect('focus_in_event', self.focus_in, self.adj) for panel in self.panels: panel.show_all() panel.start() self.chatbox.show_all() uistuff.keep(self.chatbox, "chat_paned_position") return __widget__
Example #19
Source File: MediaVerify.py From addons-source with GNU General Public License v2.0 | 4 votes |
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()
Example #20
Source File: campaign.py From king-phisher with BSD 3-Clause "New" or "Revised" License | 4 votes |
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()