def __init__(self): super().__init__(title="Mega Chat | Login") self.is_login = False self.is_password = False self.set_border_width(50) self.set_resizable(False) box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.add(box) top_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) box.pack_start(top_box, True, True, 0) login_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) password_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) top_box.pack_start(login_box, True, False, 5) top_box.pack_start(password_box, True, False, 5) label_login = Gtk.Label(label="Логин") login_box.pack_start(label_login, True, False, 5) self.login = Gtk.Entry() self.login.set_text("admin") self.login.connect("changed", self.on_change_login) login_box.pack_start(self.login, True, True, 0) label_password = Gtk.Label(label="Пароль") password_box.pack_start(label_password, True, False, 5) self.password = Gtk.Entry() self.password.set_text("47461031") self.password.connect("changed", self.on_changet_password) password_box.pack_start(self.password, True, True, 0) separator = Gtk.HSeparator() box.pack_start(separator, True, False, 5) bottom_box = Gtk.Box() bottom_box.set_spacing(5) box.pack_start(bottom_box, False, True, 0) b_box = Gtk.ButtonBox(orientation=Gtk.Orientation.VERTICAL) bottom_box.pack_start(b_box, False, True, 0) registration = Gtk.Button(label="Registation") registration.connect("clicked", self.on_registration) registration.set_sensitive(False) b_box.pack_start(registration, True, True, 0) b_space = Gtk.Alignment() b_box.pack_start(b_space, True, True, 0) c_box = Gtk.ButtonBox(orientation=Gtk.Orientation.VERTICAL) c_box.set_spacing(10) self.sign_in = Gtk.Button(label="Sign in") self.sign_in.connect("clicked", self.on_sign_in) # self.sign_in.set_sensitive(False) c_box.pack_start(self.sign_in, True, True, 0) bottom_box.pack_start(c_box, True, True, 0) button_close = Gtk.Button(label="Close") button_close.connect("clicked", Gtk.main_quit) c_box.pack_end(button_close, True, True, 0)
def __create_gui(self): self.gui.get_container_widget().remove(self.gui.textview) vbox = Gtk.VBox(orientation=Gtk.Orientation.VERTICAL) vbox.set_spacing(4) grid = Gtk.Grid() grid.set_column_spacing(10) grid.set_row_spacing(1) label = Gtk.Label(_("Port:")) self.entry_port = NumberEntry() self.entry_port.set_text("8888") self.random_port = Gtk.CheckButton("Random port") self.random_port.connect("clicked", self.cb_random) self.start_browser = Gtk.CheckButton("Start browser") self.development_mode = Gtk.CheckButton("Development mode") #self.development_mode.set_active(True) grid.attach(label, 0, 0, 1, 1) grid.attach(self.entry_port, 1, 0, 1, 1) #grid.attach( self.random_port, 2, 0, 1, 1 ) #grid.attach( self.start_browser, 3, 0, 1, 1 ) #grid.attach( self.development_mode, 2, 1, 1, 1 ) butbox = Gtk.ButtonBox() self.but_start = Gtk.Button(label=_('Start server')) self.but_start.connect("clicked", self.cb_start) #butbox.pack_start(self.but_start, False, True, 0) grid.attach(self.but_start, 1, 1, 1, 1) self.but_stop = Gtk.Button(label=_('Stop server')) self.but_stop.connect("clicked", self.cb_stop) #butbox.pack_start(self.but_stop, False, True, 0) self.but_stop.set_sensitive(False) grid.attach(self.but_stop, 2, 1, 1, 1) butbox2 = Gtk.ButtonBox() self.but_refresh = Gtk.Button(label=_('Refresh tree')) self.but_refresh.connect("clicked", self.cb_refresh) #butbox2.pack_start(self.but_refresh, False, True, 0) self.but_refresh.set_sensitive(False) grid.attach(self.but_refresh, 1, 2, 1, 1) self.start_browser = Gtk.Button(label=_('Start browser')) self.start_browser.connect("clicked", self.cb_start_browser) self.start_browser.set_sensitive(False) #butbox2.pack_start(self.start_browser, False, True, 0) grid.attach(self.start_browser, 2, 2, 1, 1) vbox.pack_start(grid, False, True, 0) #vbox.pack_start(butbox, False, True, 0) #vbox.pack_start(butbox2, False, True, 0) vbox.pack_start(self.gui.textview, '', '', True) self.gui.get_container_widget().add_with_viewport(vbox) vbox.show_all() return vbox
def _init_interface(self): self.create_widget() self.apply_btn.connect('clicked', self.clicked) hbox = Gtk.Box() hbox.show() image = Gtk.Image() image.set_from_stock(Gtk.STOCK_UNDO, Gtk.IconSize.BUTTON) image.show() label = Gtk.Label(label=_('Reset')) label.show() hbox.pack_start(image, False, False, 0) hbox.pack_start(label, False, True, 0) hbox.set_spacing(4) self.clear_btn.add(hbox) self.clear_btn.connect('clicked', self.clear) hbox = Gtk.ButtonBox() hbox.set_layout(Gtk.ButtonBoxStyle.START) hbox.set_spacing(6) hbox.set_border_width(12) hbox.add(self.apply_btn) hbox.add(self.clear_btn) hbox.show() self.vbox.pack_start(hbox, False, False, 0) self.vbox.show()
def __init__(self, header): Gtk.Grid.__init__(self, expand=True, margin=10, orientation=Gtk.Orientation.VERTICAL, row_spacing=15, hexpand=True, vexpand=True) self.header = Gtk.Label(label="<big><b>%s</b></big>" % header, use_markup=True, hexpand=True, vexpand=False, margin_top=15) self.body = Gtk.Grid(row_spacing=10, column_spacing=10, hexpand=True, vexpand=True, valign=Gtk.Align.CENTER, halign=Gtk.Align.CENTER) self.buttons = Gtk.ButtonBox(orientation=Gtk.Orientation.HORIZONTAL, layout_style=Gtk.ButtonBoxStyle.EDGE, hexpand=True, vexpand=False) self.attach(self.header, 0, 0, 1, 1) self.attach(self.body, 0, 1, 1, 1) self.attach(self.buttons, 0, 2, 1, 1) self.line = 0
def __create_gui(self): """ Build the GUI but hide the components that are not shown initially """ vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) vbox.set_spacing(4) label = Gtk.Label( _("Select a place and press button to set it as an enclosing place" )) label.set_halign(Gtk.Align.START) label.set_line_wrap(True) button_box = Gtk.ButtonBox() button_box.set_layout(Gtk.ButtonBoxStyle.START) but1 = Gtk.Button(label=_('Select enclosing place')) but1.connect("clicked", self.__select) button_box.add(but1) self.selected = Gtk.Label() self.selected.set_halign(Gtk.Align.START) but2 = Gtk.Button(label=_('Set enclosing place')) but2.connect("clicked", self.__set_enclosing_place) vbox.pack_start(label, False, True, 0) vbox.pack_start(but1, False, True, 0) vbox.pack_start(button_box, False, True, 10) vbox.pack_start(self.selected, False, True, 10) vbox.pack_start(but2, False, True, 0) vbox.show_all() return vbox
def __init__(self, playlist, player): PlaylistPageBase.__init__(self) self.playlist = playlist self.swindow = Gtk.ScrolledWindow() self.swindow.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) self.pack_start(self.swindow, True, True, 0) self.view = PlaylistView(self.playlist, player) self.swindow.add(self.view) hbox = Gtk.ButtonBox() hbox.set_halign(Gtk.Align.END) button = Gtk.Button(stock=Gtk.STOCK_CLEAR) button.connect('clicked', self.on_clear_history) hbox.pack_start(button, True, True, 0) button = Gtk.Button(stock=Gtk.STOCK_SAVE) button.connect('clicked', self.on_save_history) hbox.pack_start(button, True, True, 0) self.pack_start(hbox, False, False, 0) self.show_all()
def __init__(self, title, description, button_text, orange_button_text=None): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self.sw = ScrolledWindow() self.sw.apply_styling_to_widget(wide=False) self.title = Heading(title, description) self.kano_button = KanoButton(button_text) self.kano_button.pack_and_align() self.pack_start(self.title.container, False, False, 0) self.pack_start(self.sw, True, True, 0) if orange_button_text: box_align = Gtk.Alignment(xscale=0, xalign=0.5) button_box = Gtk.ButtonBox(orientation=Gtk.Orientation.HORIZONTAL, spacing=40) label = Gtk.Label("") self.orange_button = OrangeButton(orange_button_text) button_box.pack_start(label, False, False, 0) button_box.pack_start(self.kano_button.align, False, False, 0) button_box.pack_start(self.orange_button, False, False, 0) box_align.add(button_box) self.pack_start(box_align, False, False, 0) else: self.pack_start(self.kano_button.align, False, False, 0)
def __init__(self, win, char_creator): Gtk.EventBox.__init__(self) self._win = win # Should this be inherited, passed as a variable, or global? # Could be a member variable in window. # self.char_creator = self._win.get_char_creator() self.char_creator = char_creator self._win.pack_in_main_content(self.char_creator) self.char_creator.reset_selected_menu_items() self._save_changes_button = KanoButton(_("Save changes").upper()) self._save_changes_button.connect('clicked', self.save_changes) self._save_changes_button.set_sensitive(False) self.char_creator.connect('character_changed', self._make_button_sensitive) discard_changes_button = OrangeButton(_("Discard").upper()) discard_changes_button.connect('clicked', self.discard) discard_changes_button.set_margin_left(100) empty_label = Gtk.Label("") button_box = Gtk.ButtonBox() button_box.pack_start(discard_changes_button, False, False, 0) button_box.pack_start(self._save_changes_button, False, False, 0) button_box.pack_start(empty_label, False, False, 0) self._win.pack_in_bottom_bar(button_box) self._win.show_all() # Hide all the pop ups self.char_creator._hide_pop_ups()
def __init__(self): uigtk.widgets.CommonFrame.__init__(self, "Flotation") self.set_vexpand(False) label = uigtk.widgets.Label( "A club floated on the stock market generates a lot of initial money and is owned by the shareholders. The initial amount depends on the overall performance of the club.", leftalign=True) label.set_xalign(0) label.set_line_wrap(True) self.grid.attach(label, 0, 0, 1, 1) label = uigtk.widgets.Label( "Once the club has been floated on the stock market, it can not be taken private again.", leftalign=True) label.set_line_wrap(True) self.grid.attach(label, 0, 1, 1, 1) self.labelStatus = uigtk.widgets.Label(leftalign=True) label.set_line_wrap(True) self.grid.attach(self.labelStatus, 0, 2, 1, 1) buttonbox = Gtk.ButtonBox() buttonbox.set_layout(Gtk.ButtonBoxStyle.END) self.grid.attach(buttonbox, 0, 3, 1, 1) self.buttonFloat = uigtk.widgets.Button("_Float") self.buttonFloat.connect("clicked", self.on_float_clicked) buttonbox.add(self.buttonFloat)
def __init__(self): Gtk.ListBox.__init__(self) self.set_selection_mode(Gtk.SelectionMode.NONE) self.set_size_request(400, 500) _hbox = self.create_row() hbox = Gtk.HBox() expander = Gtk.Expander() expander.set_label('Wi-Fi') hbox.add(Gtk.Label(G.get_ip())) expander.add(hbox) _hbox.add(expander) hbox = self.create_row(VolumeWidget()) box = self.create_row(Gtk.ButtonBox()) boton_confi = Gtk.Button(stock=Gtk.STOCK_PREFERENCES) boton_cerrar = Gtk.Button('Salir') box.set_layout(Gtk.ButtonBoxStyle.CENTER) box.set_spacing(20) boton_confi.connect('clicked', lambda widget: self.emit('open-settings-window')) boton_cerrar.connect('clicked', lambda widget: self.emit('close')) box.add(boton_confi) box.add(boton_cerrar)
def _create_refresh_connect_buttons(self): '''Create the buttons used for the refresh button and the to connect to a network, and pack them into a button box. Returns the button box. ''' self._connect_btn = KanoButton(_("CONNECT")) self._connect_btn.pack_and_align() self.connect_handler = self._connect_btn.connect( 'clicked', self._first_time_connect ) self._connect_btn.set_sensitive(False) self._refresh_btn = self._create_refresh_button() # For now, show both connect and refresh buttons buttonbox = Gtk.ButtonBox() buttonbox.set_layout(Gtk.ButtonBoxStyle.CENTER) buttonbox.set_spacing(10) buttonbox.pack_start(self._refresh_btn, False, False, 0) buttonbox.pack_start(self._connect_btn.align, False, False, 0) if self._win.is_plug(): self._skip_btn = WhiteButton(_("Skip")) buttonbox.pack_start(self._skip_btn, False, False, 0) self._skip_btn.connect('clicked', self.skip) else: blank_label = Gtk.Label("") buttonbox.pack_start(blank_label, False, False, 0) return buttonbox
def __init__(self): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL, spacing=2) self._treeviewscroll = Gtk.ScrolledWindow() self._treeviewscroll.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) self.pack_start(self._treeviewscroll, True, True, 0) model = Gtk.ListStore(str, str, str) self._treeview = Gtk.TreeView(model) self._treeview.connect("cursor-changed", self._on_treeview_cursor) self._treeviewscroll.add(self._treeview) for i, title in enumerate(["Type", "Name", "Fields"]): renderer = Gtk.CellRendererText() column = Gtk.TreeViewColumn(title, renderer, text=i) self._treeview.append_column(column) self._button_box = Gtk.ButtonBox( orientation=Gtk.Orientation.HORIZONTAL) self.pack_start(self._button_box, False, False, 0) self._add_button = Gtk.Button("Add...") self._add_button.connect("clicked", self._on_add_clicked) self._button_box.pack_start(self._add_button, True, True, 0) self._count_label = Gtk.Label("0 sensors") self._button_box.pack_start(self._count_label, False, False, 0) self._remove_button = Gtk.Button("Remove") self._remove_button.set_sensitive(False) self._remove_button.connect("clicked", self._on_remove_clicked) self._button_box.pack_start(self._remove_button, True, True, 0) self._sensors = list() self._changes_allowed = True
def __init__(self, **options): name = _("Overview Shortcut") Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL, spacing=0) _GSettingsTweak.__init__(self, name, "org.gnome.mutter", "overlay-key", loaded=_shell_loaded, **options) box_btn = Gtk.ButtonBox() box_btn.set_layout(Gtk.ButtonBoxStyle.EXPAND) btn1 = Gtk.RadioButton.new_with_label_from_widget( None, _("Left Super")) btn1.set_property("draw-indicator", False) btn2 = Gtk.RadioButton.new_from_widget(btn1) btn2.set_label(_("Right Super")) btn2.set_property("draw-indicator", False) if (self.settings.get_string(self.key_name) == "Super_R"): btn2.set_active(True) btn1.connect("toggled", self.on_button_toggled, "Super_L") btn2.connect("toggled", self.on_button_toggled, "Super_R") box_btn.pack_start(btn1, True, True, 0) box_btn.pack_start(btn2, True, True, 0) build_label_beside_widget(name, box_btn, hbox=self)
def __init__(self, clipboard, *args, **kwargs): # initial tasks: super().__init__(*args, **kwargs) self.clipboard = clipboard self.set_default_geometry(640, 480) # get two main GObjects cont = self.get_content_area() act = self.get_action_area() # create default layout self.notebook = Gtk.Notebook() button_box = Gtk.ButtonBox() cont.add(Gtk.Label(label="UNDER CONSTRUCTION", use_underline=True)) cont.add(self.notebook) act.add(button_box) self.cancel_button = Gtk.Button(label="Cancel") #self.cancel_button.connect("clicked", self.get_root_window().destroy) button_box.pack_end(self.cancel_button, True, True, 5) self.general_buffer = Gtk.TextBuffer(text="No information given yet") general_text = Gtk.TextView(justification=3, valign=Gtk.Align.FILL, buffer=self.general_buffer) self.general_button = Gtk.Button(label="Copy to clipboard") text = self.get_general_text() self.general_button.connect("clicked", self._set_clipboard, self.clipboard, text) vbox_general = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, vexpand=True) vbox_general.pack_start(general_text, True, True, 5) vbox_general.pack_end(self.general_button, False, False, 5) self.notebook.append_page(vbox_general, self.NotebookLabel(label="General"))
def _make_score_palette(self): bb = Gtk.ButtonBox(orientation=Gtk.Orientation.VERTICAL, layout_style=Gtk.ButtonBoxStyle.EXPAND) upvote = Gtk.RadioToolButton(icon_name='reddit-upvote-symbolic') upvote.get_style_context().add_class('upvote') bb.add(upvote) novote = Gtk.RadioToolButton(icon_name='reddit-novote-symbolic', group=upvote) bb.add(novote) downvote = Gtk.RadioToolButton(icon_name='reddit-downvote-symbolic', group=upvote) downvote.get_style_context().add_class('downvote') bb.add(downvote) bb.show_all() if self._data.get('likes') is True: upvote.props.active = True elif self._data.get('likes') is False: downvote.props.active = True else: novote.props.active = True upvote.connect('toggled', self.__vote_toggled_cb, +1) novote.connect('toggled', self.__vote_toggled_cb, 0) downvote.connect('toggled', self.__vote_toggled_cb, -1) palette = Gtk.Popover() palette.add(bb) return palette
def db_missing_song_cb(self, db, song_file, *fields): search_window = Gtk.Window( destroy_with_parent=True, transient_for=self.win, window_position=Gtk.WindowPosition.CENTER_ON_PARENT, default_width=500, default_height=500, title=_("Replace {}").format(' / '.join(fields))) search_window.update_title = lambda *args: None search_component = search.Search(self.unit) search_component.entry.set_text(' '.join( '{}="{}"'.format(field, fields[i]) for i, field in enumerate(db.MISSING_SONG_FIELDS))) button_box = Gtk.ButtonBox(visible=True, layout_style=Gtk.ButtonBoxStyle.CENTER) cancel_button = Gtk.Button(visible=True, label=_("_Cancel"), use_underline=True) cancel_button.connect('clicked', lambda button: button.get_toplevel().destroy()) button_box.add(cancel_button) ok_button = Gtk.Button(visible=True, label=_("_OK"), use_underline=True) ok_button.connect('clicked', self.db_missing_song_ok_cb, db, search_component, song_file) button_box.add(ok_button) search_component.get_child().add(button_box) search_window.add(search_component) search_window.present()
def __init__(self): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) kano_button_text = _("CREATE") skip_button_text = _("Skip") login_button_text = _("I have a profile") header = _('Keep your creations safe') subheader = _( 'Create a Kano World account so you never lose your progress...\n' 'and to get inspired by creations from the community') img_width = 590 img_height = 270 self.skip_button = OrangeButton(skip_button_text) self.login_button = OrangeButton(login_button_text) image_filename = get_image('login', "", 'first-screen', str(img_width) + 'x' + str(img_height)) self.image = Gtk.Image.new_from_file(image_filename) self.pack_start(self.image, False, False, 0) self.heading = Heading(header, subheader) self.kano_button = KanoButton(kano_button_text) self.pack_start(self.heading.container, False, False, 0) self.button_box = Gtk.ButtonBox(spacing=10) self.button_box.set_layout(Gtk.ButtonBoxStyle.SPREAD) self.pack_start(self.button_box, False, False, 0) self.button_box.pack_start(self.login_button, False, False, 0) self.button_box.pack_start(self.kano_button, False, False, 0) self.button_box.pack_start(self.skip_button, False, False, 0)
def _create_buttons_box(): bb = Gtk.ButtonBox(Gtk.Orientation.HORIZONTAL) bb.set_layout(Gtk.ButtonBoxStyle.END) bb._details = _new_button(None, 'dialog-information', _SMALL_BUTTON_ICON_SIZE, tooltip=_("Show Technical Details"), toggle=True, clicked=_update_details) bb.add(bb._details) bb.set_child_secondary(bb._details, True) bb.set_child_non_homogeneous(bb._details, True) def _pair_new_device(trigger): assert _find_selected_device_id() is not None receiver = _find_selected_device() assert receiver is not None assert bool(receiver) assert receiver.kind is None _action.pair(_window, receiver) bb._pair = _new_button(_("Pair new device"), 'list-add', clicked=_pair_new_device) bb.add(bb._pair) def _unpair_current_device(trigger): assert _find_selected_device_id() is not None device = _find_selected_device() assert device is not None assert bool(device) assert device.kind is not None _action.unpair(_window, device) bb._unpair = _new_button(_("Unpair"), 'edit-delete', clicked=_unpair_current_device) bb.add(bb._unpair) return bb
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)
def __init__(self): Gtk.Window.__init__(self, title='Gnome password') self.set_size_request(300, 100) self.set_border_width(6) self.set_position(Gtk.WindowPosition.CENTER) self.connect('delete-event', Gtk.main_quit) self.password = Gtk.Entry() self.password.set_visibility(False) self.password.set_placeholder_text('Enter your password') self.password.set_icon_from_stock(Gtk.EntryIconPosition.PRIMARY, Gtk.STOCK_DIALOG_AUTHENTICATION) self.ok_button = Gtk.Button('Ok') self.cancel_button = Gtk.Button('Cancel') self.cancel_button.connect('clicked', Gtk.main_quit) button_box = Gtk.ButtonBox(orientation=Gtk.Orientation.HORIZONTAL, spacing=6) button_box.set_layout(Gtk.ButtonBoxStyle.END) button_box.pack_start(self.ok_button, False, False, 0) button_box.pack_start(self.cancel_button, False, False, 0) vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0) self.add(vbox) vbox.pack_start(self.password, True, True, 0) vbox.pack_start(button_box, False, False, 0) self.show_all()
def __init__(self): self.win = Gtk.Window() self.win.connect("delete-event", Gtk.main_quit) self.win.set_default_size(720, 480) self.fig = Figure(figsize=(10, 10), dpi=100) self.ax = self.fig.add_subplot() self.canvas = FigureCanvas(self.fig) sw = Gtk.ScrolledWindow() sw.set_border_width(10) sw.add(self.canvas) upperside = Gtk.ButtonBox(orientation=Gtk.Orientation.VERTICAL) self.fill_btnbox(upperside, TIMINGS) lowerside = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.spin = Gtk.SpinButton() self.spin.set_range(1, 2**16) #TODO: find out how to remove upper bound self.spin.set_increments(1, 10) self.spin.set_value(self.iterc) self.spin.connect("value-changed", self._on_spin) lowerside.pack_end(self.spin, False, True, 0) lowerside.pack_end(Gtk.Label.new("↓Iterations↓"), False, True, 0) self.progr2 = Gtk.ProgressBar() lowerside.pack_end(self.progr2, False, True, 2) self.progr1 = Gtk.ProgressBar() lowerside.pack_end(self.progr1, False, True, 2) sidebar = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) sidebar.pack_start(upperside, False, True, 10) sidebar.pack_start(lowerside, True, True, 2) self.box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) self.box.pack_start(sidebar, False, True, 2) self.box.pack_start(sw, True, True, 0) self.win.add(self.box) self.win.show_all() self.progr1.set_opacity(0) self.progr2.set_opacity(0)
def __init__(self, img_filename, title, description, kano_button_text, orange_button_text): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) if img_filename: self.image = Gtk.Image.new_from_file(img_filename) self.pack_start(self.image, False, False, 0) self.heading = Heading(title, description) self.kano_button = KanoButton(kano_button_text) self.pack_start(self.heading.container, False, False, 0) self.button_box = Gtk.ButtonBox(spacing=10) self.button_box.set_layout(Gtk.ButtonBoxStyle.SPREAD) self.button_box.set_margin_bottom(30) self.pack_start(self.button_box, False, False, 0) if not orange_button_text == "": self.orange_button = OrangeButton(orange_button_text) self.button_box.pack_start(self.orange_button, False, False, 0) self.button_box.pack_start(self.kano_button, False, False, 0) # The empty label is to centre the kano_button label = Gtk.Label(" ") self.button_box.pack_start(label, False, False, 0) else: self.button_box.pack_start(self.kano_button, False, False, 0)
def draw_window(self): """Draw the bookmark dialog box.""" self.top = Gtk.Dialog(parent=self.parent_window) self.top.vbox.set_spacing(5) label = Gtk.Label(label='<span size="larger" weight="bold">%s</span>' % _("Organize Bookmarks")) label.set_use_markup(True) self.top.vbox.pack_start(label, 0, 0, 5) box = Gtk.Box() self.top.vbox.pack_start(box, 1, 1, 5) name_titles = [(_('Name'), -1, 200), (_('ID'), -1, 50), ('', -1, 0)] self.namelist = Gtk.TreeView() self.namemodel = ListModel(self.namelist, name_titles) slist = Gtk.ScrolledWindow() slist.add(self.namelist) slist.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) box.pack_start(slist, 1, 1, 5) bbox = Gtk.ButtonBox(orientation=Gtk.Orientation.VERTICAL) bbox.set_layout(Gtk.ButtonBoxStyle.START) bbox.set_spacing(6) up = Gtk.Button.new_with_mnemonic(_('_Up')) down = Gtk.Button.new_with_mnemonic(_('_Down')) delete = Gtk.Button.new_with_mnemonic(_('_Remove')) up.connect('clicked', self.up_clicked) down.connect('clicked', self.down_clicked) delete.connect('clicked', self.delete_clicked) self.top.add_button(_('_Close'), Gtk.ResponseType.CLOSE) self.top.add_button(_('_Help'), Gtk.ResponseType.HELP) self.top.connect('delete-event', self.close) bbox.add(up) bbox.add(down) bbox.add(delete) box.pack_start(bbox, 0, 0, 5)
def do_activate(self): if self.box is not None: return css = f''' .{self.BUTTON_CSS_CLASS} {{ font-family: "Amiri Quran"; font-size: 20pt; }} ''' provider = Gtk.CssProvider() provider.load_from_data(css.encode("utf-8")) context = Gtk.StyleContext() screen = Gdk.Screen.get_default() context.add_provider_for_screen(screen, provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) self.box = Gtk.ButtonBox() self.box.set_layout(Gtk.ButtonBoxStyle.CENTER) for c in self.CHARS: button = Gtk.Button.new_with_label(c) button.connect("clicked", self.on_button_clicked) button.get_style_context().add_class(self.BUTTON_CSS_CLASS) self.box.pack_start(button, True, True, 0) self.box.show_all() panel = self.window.get_bottom_panel() panel.add_titled(self.box, "QuranTools", _("Quran Tools"))
def __init__(self, parent): super().__init__() headerbar = Gtk.HeaderBar(title='Preferences') headerbar.set_has_subtitle(False) headerbar.set_show_close_button(False) headerbar.get_style_context().remove_class("header-bar") self.set_titlebar(headerbar) self.set_title('Preferences') self.set_modal(True) self.set_transient_for(parent) content = self.get_content_area() content.homogeneous = False content.margin_left = 12 content.margin_right = 12 close_button = Gtk.Button(label="Close") close_button.connect("clicked", self.close_dialog) close_button.margin_bottom = 12 close_button.margin_right = 5 button_box = Gtk.ButtonBox() button_box.set_layout(Gtk.ButtonBoxStyle.END) button_box.pack_end(close_button, False, False, 12) content.add(button_box)
def __init__(self, view=None): self.accelerators = None Gtk.Window.__init__(self, title="Download Keyman keyboards") self.endonclose = False self.viewwindow = view init_accel(self) vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) s = Gtk.ScrolledWindow() webview = WebKit2.WebView() webview.connect("decide-policy", self.keyman_policy) webview.load_uri("https://keyman.com/go/linux/" + __releaseversion__ + "/download-keyboards") s.add(webview) vbox.pack_start(s, True, True, 0) bbox = Gtk.ButtonBox(spacing=12, orientation=Gtk.Orientation.HORIZONTAL) button = Gtk.Button.new_with_mnemonic("_Close") button.connect("clicked", self.on_close_clicked) bbox.pack_end(button, False, False, 12) bind_accelerator(self.accelerators, button, '<Control>w') vbox.pack_start(bbox, False, False, 12) self.add(vbox) self.getinfo = GetInfo(self.viewwindow.incomplete_kmp)
def __init__(self, app): Gtk.Window.__init__(self, title="Source.View Example", application=app) self.set_border_width(10) self.set_default_size(450, 450) bb = Gtk.ButtonBox() bb.set_orientation(Gtk.Orientation.HORIZONTAL) bb.set_spacing(2) swb = GtkSource.StyleSchemeChooserButton.new() bb.add(swb) bb.set_child_secondary(swb, True) box = Gtk.Box() box.set_orientation(Gtk.Orientation.VERTICAL) box.set_spacing(5) box.pack_start(bb, False, False, 0) scrolled_window = Gtk.ScrolledWindow() scrolled_window.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) box.pack_start(scrolled_window, True, True, 0) sourceview = GtkSource.View.new() buf = sourceview.get_buffer() lm = GtkSource.LanguageManager() buf.set_language(lm.get_language("python3")) scrolled_window.add(sourceview) sourcefile = GtkSource.File() sourcefile.set_location(Gio.File.new_for_path(python_file)) loader = GtkSource.FileLoader.new(buf, sourcefile) loader.load_async(0, None, None, None, None, None) wrap_mode = Gtk.WrapMode(2) sourceview.set_wrap_mode(wrap_mode) self.add(box)
def __init__(self, **options): name = _("Placement") Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL, spacing=0) _GSettingsTweak.__init__(self, name, "org.gnome.desktop.wm.preferences", "button-layout", **options) box_btn = Gtk.ButtonBox() box_btn.set_layout(Gtk.ButtonBoxStyle.EXPAND) # Translators: For RTL languages, this is the "Right" direction since the # interface is flipped btn1 = Gtk.RadioButton.new_with_label_from_widget(None, _("Left")) btn1.set_property("draw-indicator", False) btn2 = Gtk.RadioButton.new_from_widget(btn1) # Translators: For RTL languages, this is the "Left" direction since the # interface is flipped btn2.set_label(_("Right")) btn2.set_property("draw-indicator", False) val = self.settings.get_string(self.key_name) (left, colon, right) = val.partition(":") if "close" in right: btn2.set_active(True) btn2.connect("toggled", self.on_button_toggled) box_btn.pack_start(btn1, True, True, 0) box_btn.pack_start(btn2, True, True, 0) build_label_beside_widget(name, box_btn, hbox=self)
def __init__(self): Gtk.Window.__init__(self) self.set_default_size(400, 300) self.connect("destroy", Gtk.main_quit) grid = Gtk.Grid() self.add(grid) self.stack = Gtk.Stack() self.stack.set_vexpand(True) self.stack.set_hexpand(True) grid.attach(self.stack, 0, 0, 1, 1) buttonbox = Gtk.ButtonBox() buttonbox.set_layout(Gtk.ButtonBoxStyle.CENTER) grid.attach(buttonbox, 0, 1, 1, 1) for page in range(1, 4): label = Gtk.Label("Stack Content on Page %i" % (page)) name = "label%i" % page self.stack.add_named(label, name) button = Gtk.Button("Page %i" % (page)) button.connect("clicked", self.on_button_clicked, page) buttonbox.add(button)
def __init__(self): uigtk.widgets.Grid.__init__(self) grid = uigtk.widgets.Grid() self.attach(grid, 0, 0, 1, 1) self.hoardings = self.AdvertType(label="Hoardings", advert=data.user.club.hoardings, typeid=0) grid.attach(self.hoardings, 0, 0, 1, 1) self.programmes = self.AdvertType(label="Programmes", advert=data.user.club.programmes, typeid=1) grid.attach(self.programmes, 0, 1, 1, 1) buttonbox = Gtk.ButtonBox() buttonbox.set_layout(Gtk.ButtonBoxStyle.END) self.attach(buttonbox, 0, 1, 1, 1) self.buttonAssistant = uigtk.widgets.ToggleButton("_Assistant") self.buttonAssistant.set_tooltip_text( "Set assistant manager to handle advertising.") self.buttonAssistant.connect("toggled", self.on_assistant_toggled) buttonbox.add(self.buttonAssistant)