Python gi.repository.Gtk.Box() Examples
The following are 30
code examples of gi.repository.Gtk.Box().
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: heading.py From kano-toolset with GNU General Public License v2.0 | 9 votes |
def __init__(self, title, description): cssProvider = Gtk.CssProvider() cssProvider.load_from_path(common_css_dir + "/heading.css") styleContext = Gtk.StyleContext() styleContext.add_provider(cssProvider, Gtk.STYLE_PROVIDER_PRIORITY_USER) self.title = Gtk.Label(title) self.title_style = self.title.get_style_context() self.title_style.add_provider(cssProvider, Gtk.STYLE_PROVIDER_PRIORITY_USER) self.title_style.add_class('title') self.container = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=10) self.container.pack_start(self.title, False, False, 0) if description != "": self.description = Gtk.Label(description) self.description.set_justify(Gtk.Justification.CENTER) self.description.set_line_wrap(True) self.description_style = self.description.get_style_context() self.description_style.add_provider(cssProvider, Gtk.STYLE_PROVIDER_PRIORITY_USER) self.description_style.add_class('description') self.container.pack_start(self.description, False, False, 0)
Example #2
Source File: matchbox.py From kickoff-player with GNU General Public License v3.0 | 6 votes |
def __init__(self, *args, **kwargs): Gtk.Box.__init__(self, *args, **kwargs) self.fixture = self.get_property('fixture') self.home_crest = self.do_team_crest() self.home_name = self.do_team_name() self.home_box = self.do_team_box('home') self.away_crest = self.do_team_crest() self.away_name = self.do_team_name() self.away_box = self.do_team_box('away') self.score = self.do_score_label() self.score_box = self.do_score_box() self.set_orientation(Gtk.Orientation.HORIZONTAL) self.set_homogeneous(True) self.connect('realize', self.on_fixture_updated) self.connect('realize', self.on_realize) self.connect('notify::fixture', self.on_fixture_updated) self.show()
Example #3
Source File: settings.py From Authenticator with GNU General Public License v2.0 | 6 votes |
def _build_widgets(self, label, sub_label): self.get_style_context().add_class("settings-box") self.switch.set_state(Settings.get_default().get_boolean(self._schema)) self.switch.connect("state-set", self.__on_toggled) label_container = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) main_lbl = Gtk.Label() main_lbl.set_halign(Gtk.Align.START) main_lbl.get_style_context().add_class("settings-box-main-label") main_lbl.set_text(label) label_container.pack_start(main_lbl, False, False, 3) secondary_lbl = Gtk.Label() secondary_lbl.set_halign(Gtk.Align.START) secondary_lbl.get_style_context().add_class("settings-box-secondary-label") secondary_lbl.set_text(sub_label) label_container.pack_start(secondary_lbl, False, False, 3) self.pack_start(label_container, False, False, 0) switch_container = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) switch_container.pack_start(self.switch, False, False, 0) switch_container.set_valign(Gtk.Align.CENTER) self.pack_end(switch_container, False, False, 0)
Example #4
Source File: list.py From Authenticator with GNU General Public License v2.0 | 6 votes |
def _build_widgets(self, accounts_list, provider): provider_container = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) provider_lbl = Gtk.Label() provider_lbl.set_text(provider) provider_lbl.set_halign(Gtk.Align.START) provider_lbl.get_style_context().add_class("provider-lbl") provider_img = Gtk.Image() pixbuf = load_pixbuf_from_provider(provider) provider_img.set_from_pixbuf(pixbuf) provider_container.pack_start(provider_img, False, False, 3) provider_container.pack_start(provider_lbl, False, False, 3) self.pack_start(provider_container, False, False, 3) self.pack_start(accounts_list, False, False, 3)
Example #5
Source File: add.py From Authenticator with GNU General Public License v2.0 | 6 votes |
def __init__(self, **kwargs): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) GObject.GObject.__init__(self) self.is_edit = kwargs.get("edit", False) self._account = kwargs.get("account", None) self._providers_store = Gtk.ListStore(str, str) self.logo_img = Gtk.Image() self.username_entry = Gtk.Entry() self.provider_combo = Gtk.ComboBox.new_with_model_and_entry( self._providers_store) self.token_entry = Gtk.Entry() self._build_widgets() self._fill_data()
Example #6
Source File: gnupg.py From Authenticator with GNU General Public License v2.0 | 6 votes |
def _build_widgets(self): header_bar = Gtk.HeaderBar() header_bar.set_show_close_button(True) header_bar.set_title(_("GPG paraphrase")) apply_btn = Gtk.Button() apply_btn.set_label(_("Import")) apply_btn.get_style_context().add_class("suggested-action") apply_btn.connect("clicked", self.__on_apply) header_bar.pack_end(apply_btn) self.set_titlebar(header_bar) container = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.paraphrase_widget = SettingsBoxWithEntry(_("Paraphrase"), True) container.pack_start(self.paraphrase_widget, False, False, 0) container.get_style_context().add_class("settings-main-container") self.add(container)
Example #7
Source File: kano_dialog.py From kano-toolset with GNU General Public License v2.0 | 6 votes |
def __colour_dialog_background(self): content_area = self.dialog.get_content_area() self.content_background = Gtk.EventBox() self.add_style(self.content_background, 'white') self.content_background.set_size_request(140, 140) content_area.reparent(self.content_background) action_area = self.dialog.get_action_area() self.action_background = Gtk.EventBox() self.add_style(self.action_background, 'white') action_area.reparent(self.action_background) action_area.set_layout(Gtk.ButtonBoxStyle.CENTER) # Set area around the buttons grey by default self.set_action_background('grey') container = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) container.add(self.content_background) container.add(self.action_background) self.dialog.add(container) return content_area, action_area
Example #8
Source File: buttons.py From kano-toolset with GNU General Public License v2.0 | 6 votes |
def __init__(self, text="", icon_filename=""): Gtk.Button.__init__(self) apply_colours_to_widget(self) self.internal_box = Gtk.Box(spacing=10) self.internal_box.props.halign = Gtk.Align.CENTER self.add(self.internal_box) if icon_filename: self.icon = Gtk.Image.new_from_file(icon_filename) self.internal_box.pack_start(self.icon, False, False, 0) self.label = Gtk.Label(text) self.internal_box.pack_start(self.label, False, False, 0) else: self.label = Gtk.Label(text) self.internal_box.add(self.label) cursor.attach_cursor_events(self)
Example #9
Source File: labelled_entries.py From kano-toolset with GNU General Public License v2.0 | 6 votes |
def add_heading(text, widget, bold=False): label = Gtk.Label(text) label_alignment = Gtk.Alignment(xscale=0, xalign=0) label_alignment.add(label) if bold: label.get_style_context().add_class("bold_label") else: label.get_style_context().add_class("desc_label") box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) box.pack_start(label_alignment, False, False, 3) box.pack_start(widget, False, False, 3) return box
Example #10
Source File: labelled_entries.py From kano-toolset with GNU General Public License v2.0 | 6 votes |
def create_custom_label(heading, description=""): heading_label = Gtk.Label(heading) heading_label.get_style_context().add_class("bold_label") box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) box.pack_start(heading_label, False, False, 0) if description: description_label = Gtk.Label(description) description_label.get_style_context().add_class("desc_label") box.pack_start(description_label, False, False, 0) align = Gtk.Alignment(yscale=0, yalign=0.5) align.add(box) return align
Example #11
Source File: tab.py From ImEditor with GNU General Public License v3.0 | 6 votes |
def __init__(self, win, tab, title, img): Gtk.Box.__init__(self) self.set_spacing(5) self.win = win self.tab = tab # Preview of image self.icon = Gtk.Image() # Title self.label = Gtk.Label() self.set_title(title) # Close button button = Gtk.Button() button.set_relief(Gtk.ReliefStyle.NONE) button.add(Gtk.Image.new_from_icon_name('window-close', Gtk.IconSize.MENU)) button.connect('clicked', self.on_close_button_clicked) self.add(self.icon) self.add(self.label) self.add(button) self.show_all()
Example #12
Source File: headerbar.py From Authenticator with GNU General Public License v2.0 | 6 votes |
def _build_widgets(self): """ Generate the HeaderBar widgets """ self.set_show_close_button(True) left_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) right_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) # Hide the search button if nothing is found if Database.get_default().count > 0: self.search_btn.show_() else: self.search_btn.hide_() left_box.add(self.add_btn) right_box.pack_start(self.search_btn, False, False, 0) right_box.pack_start(self.select_btn, False, False, 0) right_box.pack_start(self.cancel_btn, False, False, 0) right_box.pack_end(self.settings_btn, False, False, 3) self.pack_start(left_box) self.pack_end(right_box)
Example #13
Source File: gstbox.py From kickoff-player with GNU General Public License v3.0 | 6 votes |
def __init__(self, *args, **kwargs): Gtk.Box.__init__(self, *args, **kwargs) self.gtksink = Gst.ElementFactory.make('gtksink') self.swidget = self.gtksink.props.widget self.pack_start(self.swidget, True, True, 0) self.playbin = Gst.ElementFactory.make('playbin') self.playbin.set_property('video-sink', self.gtksink) self.playbin.set_property('force-aspect-ratio', True) self.dbus = self.playbin.get_bus() self.dbus.add_signal_watch() self.dbus.connect('message', self.on_dbus_message) add_widget_class(self, 'player-video')
Example #14
Source File: channelbox.py From kickoff-player with GNU General Public License v3.0 | 6 votes |
def __init__(self, *args, **kwargs): Gtk.Box.__init__(self, *args, **kwargs) self.channel = self.get_property('channel') self.callback = self.get_property('callback') self.streams = None self.set_orientation(Gtk.Orientation.HORIZONTAL) self.set_homogeneous(True) self.connect('realize', self.on_channel_updated) self.connect('notify::channel', self.on_channel_updated) add_widget_class(self, 'channel-streams') self.show()
Example #15
Source File: channelbox.py From kickoff-player with GNU General Public License v3.0 | 6 votes |
def __init__(self, *args, **kwargs): Gtk.Box.__init__(self, *args, **kwargs) self.channel = self.get_property('channel') self.channel_logo = self.do_channel_logo() self.channel_name = self.do_channel_name() self.channel_language = self.do_channel_language() self.set_orientation(Gtk.Orientation.VERTICAL) self.set_margin_top(10) self.set_margin_bottom(10) self.set_margin_left(10) self.set_margin_right(10) self.set_spacing(10) self.connect('realize', self.on_channel_updated) self.connect('realize', self.on_realize) self.connect('notify::channel', self.on_channel_updated) self.show()
Example #16
Source File: templates.py From kano-settings with GNU General Public License v2.0 | 6 votes |
def __init__(self, title, description, left_btn_text, right_btn_text, buttons_shown): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self.title = Heading(title, description) self.title.container.set_margin_bottom(0) self.sw = ScrolledWindow() self.sw.apply_styling_to_widget(wide=False) self.left_button = KanoButton(left_btn_text, color='orange') self.right_button = KanoButton(right_btn_text, color='green') kano_button_box = Gtk.ButtonBox() kano_button_box.set_layout(Gtk.ButtonBoxStyle.CENTER) kano_button_box.set_spacing(20) if buttons_shown == 2: kano_button_box.pack_start(self.left_button, False, False, 0) kano_button_box.pack_start(self.right_button, False, False, 0) self.pack_start(self.title.container, False, False, 0) self.pack_start(self.sw, True, True, 0) self.pack_end(kano_button_box, False, False, 0)
Example #17
Source File: templates.py From kano-settings with GNU General Public License v2.0 | 6 votes |
def __init__( self, title, description, button_text, is_plug=False, back_btn=False ): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self.title = Heading(title, description, is_plug, back_btn) self.title.container.set_margin_bottom(0) self.box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.align = Gtk.Alignment(xscale=0, yscale=0, xalign=0.5, yalign=0.3) self.align.add(self.box) self.kano_button = KanoButton(button_text) self.kano_button.pack_and_align() self.kano_button.align.set_padding(0, 30, 0, 0) self.pack_start(self.title.container, False, False, 0) self.pack_start(self.align, True, True, 0) self.pack_end(self.kano_button.align, False, False, 0)
Example #18
Source File: bluetooth_config.py From kano-settings with GNU General Public License v2.0 | 6 votes |
def __init__(self, device): Gtk.Box.__init__(self, hexpand=True) self.device = device device_name = device.name dev_label = Gtk.Label(device_name, hexpand=True) dev_label.get_style_context().add_class('normal_label') self.pack_start(dev_label, False, False, 0) self._pair_button = KanoButton() self._set_paired_button_state() self._pair_button.set_margin_top(10) self._pair_button.set_margin_bottom(10) self._pair_button.set_margin_left(10) self._pair_button.set_margin_right(10) self._pair_button.connect('clicked', self.pair) self.pack_start(self._pair_button, False, False, 0)
Example #19
Source File: NetworkScreen.py From kano-settings with GNU General Public License v2.0 | 6 votes |
def __init__(self, win, network_list): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self._win = win self._wiface = self._win.wiface # The network that the user selects self._selected_network = {} # Setting new window here self._win.set_main_widget(self) self._win.top_bar.disable_prev() box = self._create_main_box(network_list) self.add(box) self._win.show_all()
Example #20
Source File: configuration.py From king-phisher with BSD 3-Clause "New" or "Revised" License | 6 votes |
def _get_title_box(self): menu = Gtk.Menu() menu.set_property('valign', Gtk.Align.START) menu_item = Gtk.MenuItem.new_with_label('Restore Default Options') menu_item.connect('activate', self.signal_activate_plugin_reset, self.plugin_klass) menu.append(menu_item) menu.show_all() self.menu = menu plugin_menu_button = Gtk.MenuButton() plugin_menu_button.set_property('direction', Gtk.ArrowType.LEFT) plugin_menu_button.set_popup(menu) title_box = Gtk.Box(Gtk.Orientation.HORIZONTAL, 3) title_box.pack_start(Gtk.Label(label=self.plugin_klass.title), False, True, 0) title_box.pack_end(plugin_menu_button, False, False, 0) return title_box
Example #21
Source File: SpinnerScreen.py From kano-settings with GNU General Public License v2.0 | 5 votes |
def show_spinner_screen(self): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self.set_size_request(self._win.width, self._win.height) self._win.set_main_widget(self) heading = Heading( self._title, self._description, self._win.is_plug() ) self.pack_start(heading.container, False, False, 0) spinner = Gtk.Image() if self._win.is_plug(): filename = os.path.join(media_dir, "kano-wifi-gui/loading_bar.gif") else: filename = os.path.join(media_dir, "kano-wifi-gui/wifi-spinner-smaller.gif") anim = GdkPixbuf.PixbufAnimation.new_from_file(filename) spinner.set_from_animation(anim) if self._win.is_plug(): # Added extra padding for the plug screen. self.pack_start(spinner, False, False, 60) else: self.pack_start(spinner, False, False, 30) self._win.show_all()
Example #22
Source File: bluetooth_config.py From kano-settings with GNU General Public License v2.0 | 5 votes |
def __init__(self): ScrolledWindow.__init__(self, hexpand=True, vexpand=True) self.set_size_request(500, 300) self.contents = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.add_with_viewport(self.contents) self.devices = [] self.dev_view = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.contents.pack_start(self.dev_view, False, False, 0)
Example #23
Source File: list.py From Authenticator with GNU General Public License v2.0 | 5 votes |
def __init__(self): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self._build_widgets()
Example #24
Source File: home_screen.py From kano-settings with GNU General Public License v2.0 | 5 votes |
def __init__(self, win, screen_number=None, screen_name=None): self.win = win # Check if we want to initialise another window first if screen_name: self.go_to_screen(screen_name) return if screen_number is not None: self.go_to_screen_number(screen_number) return Gtk.Box.__init__(self) self.win.set_main_widget(self) self.win.top_bar.disable_prev() self.win.remove_prev_callback() self.width = 640 self.height = 304 self._col_count = 2 scrolled_window = self._generate_grid() self.pack_start(scrolled_window, True, True, 0) self.win.show_all()
Example #25
Source File: set_wallpaper.py From kano-settings with GNU General Public License v2.0 | 5 votes |
def __init__(self, win, header=_("Choose a background"), subheader="", buttons_shown=1): # This simply is a Gtk.Box with a heading, scrolledwindow and green # kano button and optionally an orange link TwoButtonTemplate.__init__(self, header, subheader, _("TRY"), _("CHOOSE"), buttons_shown) self.win = win self.get_style_context().add_class('notebook_page') # This isn't that neccessary for this screen, but is useful for the # the first screen self.left_button.set_sensitive(False) self.left_button.set_margin(10, 0, 20, 0) self.left_button.connect('button-release-event', self.set_wallpaper) self.right_button.set_margin(10, 0, 20, 0) self.right_button.set_sensitive(False) self.right_button.connect('button-release-event', self.apply_changes) # Initialise table self.table = WallpaperTable() # Add table to the scrolled window self.sw.add_with_viewport(self.table) self.adjust_size_of_sw() self.table.connect('image_selected', self.enable_kano_buttons)
Example #26
Source File: row.py From Authenticator with GNU General Public License v2.0 | 5 votes |
def __init__(self): Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL) self.copy_btn = ActionButton("edit-copy-symbolic", _("Copy")) self.edit_btn = ActionButton("document-edit-symbolic", _("Edit")) self._build_widget()
Example #27
Source File: gnupg.py From Authenticator with GNU General Public License v2.0 | 5 votes |
def _build_widgets(self): header_bar = Gtk.HeaderBar() header_bar.set_show_close_button(True) header_bar.set_title(_("GPG fingerprint")) self.set_titlebar(header_bar) container = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) keys = GPG.get_default().get_keys() self.__add_keys(keys["public"], _("Public keys"), container) self.__add_keys(keys["private"], _("Private keys"), container) container.get_style_context().add_class("settings-main-container") self.add(container)
Example #28
Source File: dialog.py From ImEditor with GNU General Public License v3.0 | 5 votes |
def params_dialog(parent, title, limits): def on_apply_clicked(button, h_scale, dialog): dialog.values.append(int(h_scale.get_value())) dialog.destroy() dialog = Dialog(parent, title) default = (limits[0] + limits[1]) / 2 h_scale = Gtk.Scale.new_with_range(Gtk.Orientation.HORIZONTAL, limits[0], limits[1], 20) h_scale.set_value(default) h_scale.set_hexpand(True) h_scale.set_valign(Gtk.Align.START) cancel_button = Gtk.Button.new_with_label(_("Cancel")) cancel_button.connect('clicked', dialog.close) ok_button = Gtk.Button.new_with_label(_("Apply")) ok_button.connect('clicked', on_apply_clicked, h_scale, dialog) ok_button.get_style_context().add_class(Gtk.STYLE_CLASS_SUGGESTED_ACTION) button_box = Gtk.Box(spacing=6) button_box.pack_start(cancel_button, True, True, 0) button_box.pack_start(ok_button, True, True, 0) dialog.dialog_box.add(h_scale) dialog.dialog_box.add(button_box) dialog.launch() return dialog
Example #29
Source File: backend_gtk3.py From matplotlib-4-abaqus with MIT License | 5 votes |
def configure_subplots(self, button): toolfig = Figure(figsize=(6,3)) canvas = self._get_canvas(toolfig) toolfig.subplots_adjust(top=0.9) tool = SubplotTool(self.canvas.figure, toolfig) w = int (toolfig.bbox.width) h = int (toolfig.bbox.height) window = Gtk.Window() try: window.set_icon_from_file(window_icon) except (SystemExit, KeyboardInterrupt): # re-raise exit type Exceptions raise except: # we presumably already logged a message on the # failure of the main plot, don't keep reporting pass window.set_title("Subplot Configuration Tool") window.set_default_size(w, h) vbox = Gtk.Box() vbox.set_property("orientation", Gtk.Orientation.VERTICAL) window.add(vbox) vbox.show() canvas.show() vbox.pack_start(canvas, True, True, 0) window.show()
Example #30
Source File: locale.py From kano-settings with GNU General Public License v2.0 | 5 votes |
def __init__(self, win): Template.__init__( self, _("Locale"), _("Set your locale (Changing this requires a reboot)"), _("APPLY CHANGES") ) dropdown_container = Gtk.Box( orientation=Gtk.Orientation.HORIZONTAL, spacing=20 ) self.box.pack_start(dropdown_container, False, False, 0) self._language_combo = self._create_language_combo() dropdown_container.pack_start(self._language_combo, False, False, 0) self._region_combo = self._create_region_combo() dropdown_container.pack_start(self._region_combo, False, False, 0) self._load_saved_settings() self.win = win self.win.set_main_widget(self) self.win.change_prev_callback(self.win.go_to_home) self.win.top_bar.enable_prev() self.kano_button.connect('clicked', self.apply_changes) self.kano_button.connect('key-release-event', self.apply_changes) self.win.show_all()