Python gi.repository.Gtk.Frame() Examples
The following are 26
code examples of gi.repository.Gtk.Frame().
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: basedialog.py From lplayer with MIT License | 6 votes |
def init_ui(self): vbox0 = Gtk.VBox(spacing=5) vbox0.set_border_width(5) self.get_content_area().add(vbox0) frame1 = Gtk.Frame() vbox0.add(frame1) self.grid = Gtk.Grid() self.grid.set_row_spacing(10) self.grid.set_column_spacing(10) self.grid.set_margin_bottom(10) self.grid.set_margin_start(10) self.grid.set_margin_end(10) self.grid.set_margin_top(10) frame1.add(self.grid)
Example #2
Source File: headerbars.py From Apostrophe with GNU General Public License v3.0 | 6 votes |
def __init__(self): self.hb = Gtk.HeaderBar().new() self.hb.props.show_close_button = True self.hb_revealer = Gtk.Revealer(name="titlebar-revealer-pv") self.hb_revealer.add(self.hb) self.hb_revealer.props.transition_duration = 750 self.hb_revealer.set_transition_type( Gtk.RevealerTransitionType.CROSSFADE) self.hb_revealer.show() self.hb_revealer.set_reveal_child(True) self.hb_container = Gtk.Frame(name="titlebar-container") self.hb_container.set_shadow_type(Gtk.ShadowType.NONE) self.hb_container.add(self.hb_revealer) self.hb_container.show() self.hb.show_all()
Example #3
Source File: slider_win.py From volctl with GNU General Public License v2.0 | 6 votes |
def __init__(self, volctl): self.volctl = volctl self._win = Gtk.Window(type=Gtk.WindowType.POPUP) self._win.connect("enter-notify-event", self._cb_enter_notify) self._win.connect("leave-notify-event", self._cb_leave_notify) self._grid = Gtk.Grid() self._grid.set_column_spacing(2) self._grid.set_row_spacing(self.SPACING) self._frame = Gtk.Frame() self._frame.set_shadow_type(Gtk.ShadowType.OUT) self._frame.add(self._grid) self._win.add(self._frame) # gui objects by index self._sink_scales = {} self._sink_input_scales = {} self._create_sliders() self._win.show_all() self._set_position() # timeout self._timeout = None self._enable_timeout()
Example #4
Source File: alttoolbar_type.py From alternative-toolbar with GNU General Public License v3.0 | 6 votes |
def _setup_playbar(self): """ setup the play controls at the bottom part of the application """ box = self.find(self.shell.props.window, 'GtkBox', 'by_name') frame_box = Gtk.Box() frame_box.set_orientation(Gtk.Orientation.VERTICAL) self.small_frame = Gtk.Frame() self.small_frame.set_shadow_type(Gtk.ShadowType.ETCHED_IN) frame_box.pack_start(self.small_frame, False, True, 0) frame_box.pack_start(self.small_bar, False, True, 1) box.pack_start(frame_box, False, True, 0) box.reorder_child(frame_box, 3) frame_box.show_all() self.show_small_bar() # hide status bar action = self.plugin.appshell.lookup_action('', 'statusbar-visible', 'win') if action: action.set_active(True)
Example #5
Source File: custom.py From Dindo-Bot with MIT License | 6 votes |
def __init__(self, background_color='#CECECE', show_grid=True, grid_color='#DDDDDD', grid_size=(15, 15), point_radius=3): Gtk.Frame.__init__(self) self.points = [] self.point_opacity = 0.7 self.point_radius = point_radius self.show_grid = show_grid self.grid_color = grid_color self.grid_size = grid_size self.background_color = background_color self.use_origin_colors = False self.add_borders = False self.drawing_area = Gtk.DrawingArea() self.drawing_area.set_has_tooltip(True) self.drawing_area.connect('draw', self.on_draw) self.drawing_area.connect('query-tooltip', self.on_query_tooltip) self.add(self.drawing_area)
Example #6
Source File: custom.py From Dindo-Bot with MIT License | 6 votes |
def __init__(self, model, columns): Gtk.Frame.__init__(self) self.perform_scroll = False self.model = model self.columns = columns self.vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.add(self.vbox) ## ScrolledWindow scrolled_window = Gtk.ScrolledWindow() self.vbox.pack_start(scrolled_window, True, True, 0) # TreeView self.tree_view = Gtk.TreeView(model) scrolled_window.add(self.tree_view) for column in columns: self.tree_view.append_column(column) self.tree_view.connect('size-allocate', self.scroll_tree_view) self.selection = self.tree_view.get_selection() self.selection.set_mode(Gtk.SelectionMode.SINGLE)
Example #7
Source File: FlatCAMApp.py From FlatCAM with MIT License | 5 votes |
def toggle_active(self, *args): if self.active: # Deactivate self.active = False self.container.remove(self.frame) if self.update is not None: self.update() self.plotcanvas.mpl_disconnect(self.click_subscription) self.plotcanvas.mpl_disconnect(self.move_subscription) return False else: # Activate App.log.debug("DEBUG: Activating Measurement Tool...") self.active = True self.click_subscription = self.plotcanvas.mpl_connect("button_press_event", self.on_click) self.move_subscription = self.plotcanvas.mpl_connect('motion_notify_event', self.on_move) self.frame = Gtk.Frame() self.frame.set_margin_right(5) self.frame.set_margin_top(3) align = Gtk.Alignment() align.set(0, 0.5, 0, 0) align.set_padding(4, 4, 4, 4) self.label = Gtk.Label() self.label.set_label("Click on a reference point...") abox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 10) abox.pack_start(Gtk.Image.new_from_file('share/measure16.png'), False, False, 0) abox.pack_start(self.label, False, False, 0) align.add(abox) self.frame.add(align) self.container.pack_end(self.frame, False, True, 1) self.frame.show_all() return True
Example #8
Source File: widgets.py From zim-desktop-wiki with GNU General Public License v2.0 | 5 votes |
def move_bottom_minimized_tabs_to_statusbar(self, statusbar): frame = Gtk.Frame() frame.set_shadow_type(Gtk.ShadowType.NONE) self._zim_window_bottom_minimized.reparent(frame) self._zim_window_bottom_minimized.status_bar_style = True statusbar.pack_end(frame, False, True, 0) frame.show_all()
Example #9
Source File: window.py From drawing with GNU General Public License v3.0 | 5 votes |
def confirm_save_modifs(self): """Return True if the image can be closed/overwritten (whether it's saved or not), or False otherwise (usually if the user clicked 'cancel', or if an error occurred).""" if self.get_active_image()._is_saved: return True fn = self.get_file_path() if fn is None: unsaved_file_name = _("Untitled") + '.png' # Context: the sentence "There are unsaved modifications to %s." display_name = _("this picture") else: unsaved_file_name = fn.split('/')[-1] display_name = self.get_active_image().get_filename_for_display() dialog = DrMessageDialog(self) discard_id = dialog.set_action(_("Discard"), 'destructive-action', False) cancel_id = dialog.set_action(_("Cancel"), None, False) save_id = dialog.set_action(_("Save"), None, True) dialog.add_string( _("There are unsaved modifications to %s.") % display_name) self.minimap.update_minimap(True) image = Gtk.Image().new_from_pixbuf(self.minimap.mini_pixbuf) frame = Gtk.Frame(valign=Gtk.Align.CENTER, halign=Gtk.Align.CENTER) frame.add(image) dialog.add_widget(frame) result = dialog.run() dialog.destroy() if result == save_id: return self.action_save() elif result == discard_id: return True else: # cancel_id return False
Example #10
Source File: statusbar.py From bokken with GNU General Public License v2.0 | 5 votes |
def remove_all(self): for child in self.box.get_children(): self.box.remove(child) for child in self.get_children(): if type(child) is not Gtk.Frame: self.remove(child)
Example #11
Source File: main.py From PiHole-Panel with GNU General Public License v3.0 | 5 votes |
def draw_top_ads_frame(self): frame_vert = Gtk.Frame(label="Top Ads") frame_vert.set_border_width(10) frame_vert.table_box = None self.grid.attach(frame_vert, 2, 4, 1, 1) return frame_vert
Example #12
Source File: main.py From PiHole-Panel with GNU General Public License v3.0 | 5 votes |
def draw_top_queries_frame(self): frame_vert = Gtk.Frame(label="Top Queries") frame_vert.set_border_width(10) frame_vert.table_box = None self.grid.attach(frame_vert, 1, 4, 1, 1) return frame_vert
Example #13
Source File: main.py From PiHole-Panel with GNU General Public License v3.0 | 5 votes |
def draw_statistics_frame(self): frame_vert = Gtk.Frame(label="Statistics") frame_vert.set_border_width(10) frame_vert.table_box = None self.grid.attach(frame_vert, 0, 4, 1, 1) return frame_vert
Example #14
Source File: custom.py From Dindo-Bot with MIT License | 5 votes |
def __init__(self): Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL, spacing=5) self.count = 0 frame = Gtk.Frame() scrolled_window = Gtk.ScrolledWindow(hscrollbar_policy=Gtk.PolicyType.NEVER) self.listbox = Gtk.ListBox() self.listbox.set_selection_mode(Gtk.SelectionMode.SINGLE) self.listbox.connect('row-activated', self.on_row_activated) scrolled_window.add(self.listbox) frame.add(scrolled_window) self.pack_start(frame, True, True, 0) self.stack = Gtk.Stack() self.pack_end(self.stack, False, False, 0)
Example #15
Source File: extras.py From king-phisher with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self, *args, **kwargs): Gtk.Frame.__init__(self, *args, **kwargs) self.get_style_context().add_class('multilineentry') textview = Gtk.TextView() self.add(textview)
Example #16
Source File: alttoolbar_repeat.py From alternative-toolbar with GNU General Public License v3.0 | 5 votes |
def add(self, widget): self._frame = Gtk.Frame() self._frame.add(widget) super(CustomPopover, self).add(self._frame) self._frame.show_all() # Popoverwindow co ordinates without off-screen correction: # Window origin (x, y) # | # V # --------------------------------- # | Main Window | # | | # | | # |Toggle button's (x, y) | # |(relative to parent window) | # | | | # | V | # | ......................... | # Popover | | Toggle Button | | # window's | | | | # (x, y)---+> ......................... | # |(window will be here) | # | | # | | # --------------------------------- # Popover Window's screen coordinates: # x = Window's origin x + Toggle Button's relative x # y = Window's origin y + Toggle Button's relative y + Toggle Button's # height
Example #17
Source File: InfoPanel.py From pychess with GNU General Public License v3.0 | 5 votes |
def onFingeringFinished(self, fm, finger, playername): if not isinstance(self.get_child(), Gtk.Label) or \ finger.getName().lower() != playername.lower(): return self.fm.disconnect(self.handle_id) label = Gtk.Label() label.set_markup("<b>%s</b>" % playername) widget = Gtk.Frame() widget.set_label_widget(label) widget.set_shadow_type(Gtk.ShadowType.NONE) alignment = Gtk.Alignment.new(0, 0, 1, 1) alignment.set_padding(3, 0, 12, 0) widget.add(alignment) text_view = Gtk.TextView() text_view.set_editable(False) text_view.set_cursor_visible(False) text_view.props.wrap_mode = Gtk.WrapMode.WORD tb_iter = text_view.get_buffer().get_end_iter() for i, note in enumerate(finger.getNotes()): if note: insert_formatted(text_view, tb_iter, "%s\n" % note) text_view.show_all() scroll_win = Gtk.ScrolledWindow() scroll_win.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) scroll_win.add(text_view) alignment.add(scroll_win) self.remove(self.get_child()) self.add(widget) widget.show_all()
Example #18
Source File: main_window.py From gtg with GNU General Public License v3.0 | 5 votes |
def remove_page_from_main_notebook(self, page): """Removes a new page tab from the top right main panel. If this leaves only one tab in the notebook, the tab selector will be hidden. @param page: Gtk.Frame-based panel to be removed """ return self._remove_page(self.main_notebook, page)
Example #19
Source File: main_window.py From gtg with GNU General Public License v3.0 | 5 votes |
def remove_page_from_sidebar_notebook(self, page): """Removes a new page tab from the left panel. If this leaves only one tab in the notebook, the tab selector will be hidden. @param page: Gtk.Frame-based panel to be removed """ return self._remove_page(self.sidebar_notebook, page)
Example #20
Source File: main_window.py From gtg with GNU General Public License v3.0 | 5 votes |
def add_page_to_main_notebook(self, title, page): """Adds a new page tab to the top right main panel. The tab will be added as the last tab. Also causes the tabs to be shown. @param title: Short text to use for the tab label @param page: Gtk.Frame-based panel to be added """ return self._add_page(self.main_notebook, Gtk.Label(label=title), page)
Example #21
Source File: main_window.py From gtg with GNU General Public License v3.0 | 5 votes |
def add_page_to_sidebar_notebook(self, icon, page): """Adds a new page tab to the left panel. The tab will be added as the last tab. Also causes the tabs to be shown if they're not. @param icon: a Gtk.Image picture to display on the tab @param page: Gtk.Frame-based panel to be added """ return self._add_page(self.sidebar_notebook, icon, page)
Example #22
Source File: custom.py From Dindo-Bot with MIT License | 4 votes |
def __init__(self, parent=None, allow_moving=True): Gtk.Frame.__init__(self) self.parent = parent self.allow_moving = allow_moving self.perform_scroll = False self.add_callback = None self.delete_callback = None self.activate_callback = None ## ListBox vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.add(vbox) self.listbox = Gtk.ListBox() self.listbox.set_selection_mode(Gtk.SelectionMode.SINGLE) self.listbox.connect('size-allocate', self.on_size_allocate) self.listbox.connect('row-activated', self.on_row_activated) scrolled_window = Gtk.ScrolledWindow() scrolled_window.add(self.listbox) vbox.pack_start(scrolled_window, True, True, 0) ## ActionBar actionbar = Gtk.ActionBar() vbox.pack_end(actionbar, False, False, 0) default_buttons_box = ButtonBox(linked=True) actionbar.pack_start(default_buttons_box) if allow_moving: # Move up self.move_up_button = Gtk.Button() self.move_up_button.set_tooltip_text('Move up') self.move_up_button.set_image(Gtk.Image(icon_name='go-up-symbolic')) self.move_up_button.connect('clicked', self.on_move_up_button_clicked) default_buttons_box.add(self.move_up_button) # Move down self.move_down_button = Gtk.Button() self.move_down_button.set_tooltip_text('Move down') self.move_down_button.set_image(Gtk.Image(icon_name='go-down-symbolic')) self.move_down_button.connect('clicked', self.on_move_down_button_clicked) default_buttons_box.add(self.move_down_button) # Delete self.delete_button = Gtk.Button() self.delete_button.set_tooltip_text('Delete') self.delete_button.set_image(Gtk.Image(icon_name='edit-delete-symbolic')) self.delete_button.connect('clicked', self.on_delete_button_clicked) default_buttons_box.add(self.delete_button) # Clear all self.clear_all_button = Gtk.Button() self.clear_all_button.set_tooltip_text('Clear all') self.clear_all_button.set_image(Gtk.Image(icon_name='edit-clear-all-symbolic')) self.clear_all_button.connect('clicked', self.on_clear_all_button_clicked) default_buttons_box.add(self.clear_all_button) # Initialise default buttons status self.reset_buttons() # Buttons box self.buttons_box = ButtonBox(linked=True) actionbar.pack_end(self.buttons_box)
Example #23
Source File: FlatCAMApp.py From FlatCAM with MIT License | 4 votes |
def __init__(self): Gtk.VBox.__init__(self, spacing=3, margin=5, vexpand=False) box1 = Gtk.Box() self.pack_start(box1, expand=False, fill=False, padding=2) l1 = Gtk.Label('Units:') box1.pack_start(l1, expand=False, fill=False, padding=2) self.units_radio = RadioSet([{'label': 'inch', 'value': 'IN'}, {'label': 'mm', 'value': 'MM'}]) box1.pack_start(self.units_radio, expand=False, fill=False, padding=2) ####### Gerber ####### l2 = Gtk.Label(margin=5) l2.set_markup('<b>Gerber Options</b>') frame1 = Gtk.Frame(label_widget=l2) self.pack_start(frame1, expand=False, fill=False, padding=2) self.gerber_group = GerberOptionsGroupUI() frame1.add(self.gerber_group) ######## Excellon ######### l3 = Gtk.Label(margin=5) l3.set_markup('<b>Excellon Options</b>') frame2 = Gtk.Frame(label_widget=l3) self.pack_start(frame2, expand=False, fill=False, padding=2) self.excellon_group = ExcellonOptionsGroupUI() frame2.add(self.excellon_group) ########## Geometry ########## l4 = Gtk.Label(margin=5) l4.set_markup('<b>Geometry Options</b>') frame3 = Gtk.Frame(label_widget=l4) self.pack_start(frame3, expand=False, fill=False, padding=2) self.geometry_group = GeometryOptionsGroupUI() frame3.add(self.geometry_group) ########## CNC ############ l5 = Gtk.Label(margin=5) l5.set_markup('<b>CNC Job Options</b>') frame4 = Gtk.Frame(label_widget=l5) self.pack_start(frame4, expand=False, fill=False, padding=2) self.cncjob_group = CNCJobOptionsGroupUI() frame4.add(self.cncjob_group) ######################################## ## App ## ########################################
Example #24
Source File: forecastw.py From my-weather-indicator with MIT License | 4 votes |
def __init__(self, location, ws, weather): Gtk.Dialog.__init__(self, 'my-weather-indicator | ' + _('Forecast')) self.set_modal(True) self.set_destroy_with_parent(True) self.connect('destroy', self.close_application) self.set_icon_from_file(comun.ICON) vbox0 = Gtk.VBox(spacing=5) vbox0.set_border_width(5) self.get_content_area().add(vbox0) label11 = Gtk.Label(label='<b>' + location + '</b>') label11.set_markup('<b>' + location + '</b>') vbox0.pack_start(label11, True, True, 0) frame = Gtk.Frame() vbox0.add(frame) hbox1 = Gtk.HBox(spacing=5) hbox1.set_border_width(5) frame.add(hbox1) self.ws = ws forecast = weather['forecasts'] self.table = Gtk.Table(rows=9, columns=5, homogeneous=False) self.table.set_col_spacings(10) self.create_labels() if self.ws == 'yahoo': total = 2 if self.ws == 'wunderground': total = 4 else: total = 5 for i in range(0, total): self.create_forecast_dor_day(forecast, i) hbox1.add(self.table) # if self.ws == 'yahoo': filename = comun.YAHOOLOGO web = comun.YAHOOWEB elif self.ws == 'worldweatheronline': filename = comun.WOLRDWEATHERONLINE web = comun.WOLRDWEATHERONLINEWEB elif self.ws == 'openweathermap': filename = comun.OPENWEATHERMAPLOGO web = comun.OPENWEATHERMAPWEB elif self.ws == 'wunderground': filename = comun.UNDERGROUNDLOGO web = comun.UNDERGROUNDWEB image = load_image(filename, size=64) image.set_alignment(0.5, 0.5) button = Gtk.Button() button.set_image(image) button.connect('clicked', (lambda x: webbrowser.open(web))) hbox1.pack_start(button, True, True, 0) # self.show_all() center(self) while Gtk.events_pending(): Gtk.main_iteration() self.run() self.destroy()
Example #25
Source File: progressdialog.py From lplayer with MIT License | 4 votes |
def __init__(self, title, parent): Gtk.Dialog.__init__(self, title, parent, Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT) self.set_position(Gtk.WindowPosition.CENTER_ALWAYS) self.set_size_request(330, 30) self.set_resizable(False) self.set_icon_from_file(comun.ICON) self.connect('destroy', self.close) self.set_modal(True) vbox = Gtk.VBox(spacing=5) vbox.set_border_width(5) self.get_content_area().add(vbox) # frame1 = Gtk.Frame() vbox.pack_start(frame1, True, True, 0) grid = Gtk.Grid() grid.set_margin_top(10) grid.set_margin_bottom(10) grid.set_margin_left(10) grid.set_margin_right(10) grid.set_column_spacing(5) grid.set_row_spacing(5) frame1.add(grid) # self.label = Gtk.Label() grid.attach(self.label, 0, 0, 2, 1) self.progressbar = Gtk.ProgressBar() self.progressbar.set_size_request(300, 0) grid.attach(self.progressbar, 0, 1, 2, 1) button_stop = Gtk.Button() button_stop.set_size_request(40, 40) button_stop.set_image( Gtk.Image.new_from_stock(Gtk.STOCK_STOP, Gtk.IconSize.BUTTON)) button_stop.connect('clicked', self.on_button_stop_clicked) grid.attach(button_stop, 3, 0, 1, 2) self.number_of_elements_processed = 0 self.number_of_elements = 0 self.show_all()
Example #26
Source File: asktext.py From textext with BSD 3-Clause "New" or "Revised" License | 4 votes |
def show_error_dialog(self, title, message_text, exception): # ToDo: Check Windows behavior!! --> -disable self._root.wm_attributes("-topmost", False) err_dialog = Tk.Toplevel(self._frame) err_dialog.minsize(300, 400) err_dialog.transient(self._frame) err_dialog.focus_force() err_dialog.grab_set() def add_textview(header, text): err_dialog_frame = Tk.Frame(err_dialog) err_dialog_label = Tk.Label(err_dialog_frame, text=header) err_dialog_label.pack(side='top', fill=Tk.X) err_dialog_text = Tk.Text(err_dialog_frame, height=10) err_dialog_text.insert(Tk.END, text) err_dialog_text.pack(side='left', fill=Tk.Y) err_dialog_scrollbar = Tk.Scrollbar(err_dialog_frame) err_dialog_scrollbar.pack(side='right', fill=Tk.Y) err_dialog_scrollbar.config(command=err_dialog_text.yview) err_dialog_text.config(yscrollcommand=err_dialog_scrollbar.set) err_dialog_frame.pack(side='top') def close_error_dialog(): # ToDo: Check Windows behavior!! -disable self._root.wm_attributes("-topmost", True) err_dialog.destroy() err_dialog.protocol("WM_DELETE_WINDOW", close_error_dialog) add_textview(message_text, str(exception)) if isinstance(exception, TexTextCommandFailed): if exception.stdout: add_textview('Stdout:', exception.stdout.decode('utf-8')) if exception.stderr: add_textview('Stderr:', exception.stderr.decode('utf-8')) close_button = Tk.Button(err_dialog, text='OK', command=close_error_dialog) close_button.pack(side='top', fill='x', expand=True)