def __init__(self, dbstate, user, options_class, name, callback=None): uistate = user.uistate tool.Tool.__init__(self, dbstate, options_class, name) self.uistate = uistate self.callback = uistate.pulse_progressbar self.batch_ops = [] self.build_batch_ops() self.assistant = Gtk.Assistant() self.assistant.set_title(_('Gramps Media Manager')) self.assistant.connect('close', self.close) self.assistant.connect('cancel', self.close) self.assistant.connect('apply', self.run) self.assistant.connect('prepare', self.prepare) intro = IntroductionPage() self.add_page(intro, Gtk.AssistantPageType.INTRO, _('Introduction')) self.selection = SelectionPage(self.batch_ops) self.add_page(self.selection, Gtk.AssistantPageType.CONTENT, _('Selection')) self.settings = SettingsPage(self.batch_ops, self.assistant) self.add_page(self.settings, Gtk.AssistantPageType.CONTENT) self.confirmation = ConfirmationPage(self.batch_ops) self.add_page(self.confirmation, Gtk.AssistantPageType.CONFIRM, _('Final confirmation')) self.conclusion = ConclusionPage(self.assistant) self.add_page(self.conclusion, Gtk.AssistantPageType.SUMMARY) self.assistant.show() self.assistant.set_forward_page_func(self.forward_page, None)
def __init__(self): self.assistant = Gtk.Assistant() self.assistant.set_default_size(-1, -1) self.assistant.set_resizable(False) self.assistant.set_wmclass("PiHole Panel", "PiHole Panel") self.assistant.set_title("PiHole Panel") self.assistant.set_position(Gtk.WindowPosition.CENTER) self.create_config_dir(config_directory) configs = self.load_configs(config_directory, config_filename) page_num = self.check_configs_and_get_page_num(configs) self.create_setup_page(configs) self.create_complete_page() self.assistant.connect("cancel", self.on_close_cancel) self.assistant.connect("close", self.on_close_cancel) self.assistant.connect("apply", self.on_apply) self.assistant.connect("prepare", self.on_prepare) self.assistant.set_current_page(page_num) if self.is_config_file_exist(config_directory, config_filename) is False: self.assistant.show()
def create(receiver): assert receiver is not None assert receiver.kind is None assistant = Gtk.Assistant() assistant.set_title( _('%(receiver_name)s: pair new device') % {'receiver_name': receiver.name}) assistant.set_icon_name('list-add') assistant.set_size_request(400, 240) assistant.set_resizable(False) assistant.set_role('pair-device') page_text = _( 'If the device is already turned on, turn if off and on again.') if receiver.remaining_pairings() and receiver.remaining_pairings() >= 0: page_text += _('\n\nThis receiver has %d pairing(s) remaining.' ) % receiver.remaining_pairings() page_text += _('\nCancelling at this point will not use up a pairing.') page_intro = _create_page(assistant, Gtk.AssistantPageType.PROGRESS, _('Turn on the device you want to pair.'), 'preferences-desktop-peripherals', page_text) spinner = Gtk.Spinner() spinner.set_visible(True) page_intro.pack_end(spinner, True, True, 24) assistant.connect('prepare', _prepare, receiver) assistant.connect('cancel', _finish, receiver) assistant.connect('close', _finish, receiver) return assistant
def create(receiver): assert receiver is not None assert receiver.kind is None assistant = Gtk.Assistant() assistant.set_title( _('%(receiver_name)s: pair new device') % {'receiver_name': receiver.name}) assistant.set_icon_name('list-add') assistant.set_size_request(400, 240) assistant.set_resizable(False) assistant.set_role('pair-device') page_intro = _create_page( assistant, Gtk.AssistantPageType.PROGRESS, _("Turn on the device you want to pair."), 'preferences-desktop-peripherals', _("If the device is already turned on,\nturn if off and on again.")) spinner = Gtk.Spinner() spinner.set_visible(True) page_intro.pack_end(spinner, True, True, 24) assistant.connect('prepare', _prepare, receiver) assistant.connect('cancel', _finish, receiver) assistant.connect('close', _finish, receiver) return assistant
def __init__(self, config: Config, on_finish: Callable, parent: Gtk.Window): self._config = config self._config.reset_named_dirs() self._on_finish = on_finish super().__init__() assistant = Gtk.Assistant( modal=True, transient_for=parent, gravity=Gdk.Gravity.CENTER, resizable=False, skip_taskbar_hint=True, skip_pager_hint=True, ) assistant.set_default_size(500, 400) assistant.set_position(Gtk.WindowPosition.CENTER) assistant.connect('apply', self._on_assistant_apply) assistant.connect('cancel', self._on_assistant_cancel) page = create_box(spacing=10, homogeneous=False) heading = create_label(texts.SETUP_HEADING) box_add(page, heading, expand=False) TEXT = create_label(texts.SETUP_TEXT) box_add(page, TEXT, expand=False) named_dirs_form = NamedDirsForm( self._config.named_dirs, self._on_named_dirs_change, parent=assistant, custom_names_enabled=False, ) box_add(page, named_dirs_form, expand=False) assistant.append_page(page) assistant.set_page_title(page, texts.SETUP_HEADING) assistant.set_page_type(page, Gtk.AssistantPageType.CONFIRM) assistant.set_page_complete(page, True) assistant.show_all()
def __init__(self): self.assistant = Gtk.Assistant() self.assistant.set_position(Gtk.WindowPosition.CENTER) self.assistant.set_title(_("System Upgrade")) self.assistant.connect("apply", self.apply_button_pressed) self.assistant.connect("cancel", self.cancel_button_pressed) self.assistant.connect("close", self.close_button_pressed) self.assistant.set_resizable(True) self.assistant.set_default_size(640, 480) # Intro page self.vbox_intro = Gtk.VBox() self.vbox_intro.set_border_width(60) page = self.assistant.append_page(self.vbox_intro) self.assistant.set_page_type(self.vbox_intro, Gtk.AssistantPageType.INTRO) self.assistant.set_page_title(self.vbox_intro, _("Introduction")) self.assistant.set_icon_name("mintupdate-release-upgrade") if not os.path.exists("/etc/linuxmint/info"): self.show_message('/usr/lib/linuxmint/mintUpdate/rel_upgrades/failure.png', _("Your system is missing critical components. A package corresponding to your edition of Linux Mint should provide the virtual package 'mint-info' and the file /etc/linuxmint/info.")) else: self.current_codename = 'unknown' self.current_edition = 'unknown' with open("/etc/linuxmint/info", "r") as info: for line in info: line = line.strip() if "EDITION=" in line: self.current_edition = line.split('=')[1].replace('"', '').split()[0] if "CODENAME=" in line: self.current_codename = line.split('=')[1].replace('"', '').split()[0] rel_path = "/usr/share/mint-upgrade-info/%s" % self.current_codename if not os.path.exists(rel_path): self.show_message('/usr/lib/linuxmint/mintUpdate/rel_upgrades/info.png', _("No upgrades were found.")) else: config = configparser.ConfigParser() config.read(os.path.join(rel_path, "info")) self.rel_target_name = config['general']['target_name'] self.rel_target_codename = config['general']['target_codename'] self.rel_editions = config['general']['editions'] if self.current_edition.lower() in self.rel_editions: label = Gtk.Label() label.set_markup(_("A new version of Linux Mint is available!")) self.vbox_intro.pack_start(label, False, False, 6) image = Gtk.Image.new_from_file(os.path.join(rel_path, "%s.png" % self.current_edition.lower())) self.vbox_intro.pack_start(image, False, False, 0) label = Gtk.Label() label.set_markup("<b>%s</b>" % self.rel_target_name) self.vbox_intro.pack_start(label, False, False, 0) self.assistant.set_page_complete(self.vbox_intro, True) self.build_assistant() else: self.show_message('/usr/lib/linuxmint/mintUpdate/rel_upgrades/info.png', _("An upgrade was found but it is not available yet for the %s edition.") % self.current_edition) self.assistant.show_all()
def create(receiver): assert receiver is not None assert receiver.kind is None global address, kind, authentication, name, passcode address = name = kind = authentication = passcode = None assistant = Gtk.Assistant() assistant.set_title( _('%(receiver_name)s: pair new device') % {'receiver_name': receiver.name}) assistant.set_icon_name('list-add') assistant.set_size_request(400, 240) assistant.set_resizable(False) assistant.set_role('pair-device') if receiver.receiver_kind == 'bolt': page_text = _( 'Press a pairing button or key until the pairing light flashes quickly.' ) page_text += '\n' page_text += _( 'You may have to first turn the device off and on again.') else: page_text = _('Turn on the device you want to pair.') page_text += '\n' page_text += _( 'If the device is already turned on, turn it off and on again.') if receiver.remaining_pairings() and receiver.remaining_pairings() >= 0: page_text += ngettext( '\n\nThis receiver has %d pairing remaining.', '\n\nThis receiver has %d pairings remaining.', receiver.remaining_pairings()) % receiver.remaining_pairings() page_text += _('\nCancelling at this point will not use up a pairing.') intro_text = _('%(receiver_name)s: pair new device') % { 'receiver_name': receiver.name } page_intro = _create_page(assistant, Gtk.AssistantPageType.PROGRESS, intro_text, 'preferences-desktop-peripherals', page_text) spinner = Gtk.Spinner() spinner.set_visible(True) page_intro.pack_end(spinner, True, True, 24) assistant.connect('prepare', _prepare, receiver) assistant.connect('cancel', _finish, receiver) assistant.connect('close', _finish, receiver) return assistant
def __init__(self, donecallback): self.assistant = Gtk.Assistant() self.assistant.set_default_size(500, 300) self.callback = donecallback self.create_page1() self.create_page2() self.create_page3() self.assistant.connect('cancel', self.on_close_cancel) self.assistant.connect('close', self.on_close_cancel) self.assistant.connect('apply', self.on_apply) self.assistant.connect('prepare', self.on_prepare) self.assistant.show()
def createAssistant(self): num_monitors = Gdk.Display.get_n_monitors(Gdk.Display.get_default()) self.window = Gtk.Assistant() self.window.set_default_size(400 * num_monitors, 400) self.window.set_resizable(False) # Page 1 grid = Gtk.Grid() grid.set_halign(Gtk.Align.CENTER) grid.set_column_spacing(400 / num_monitors) main_monitor = Gtk.RadioButton(label='Monitor #1') grid.attach(main_monitor, 0, 0, 1, 1) print(num_monitors) if num_monitors >= 2: for i in range(2, num_monitors + 1): r = Gtk.RadioButton(label=f'Monitor #{i}', group=main_monitor) grid.attach(r, i, 0, i, 1) self.window.append_page(grid) self.window.set_page_complete(grid, True) # Page 2 grid = Gtk.Grid() stack = Gtk.Stack() stack.set_vexpand(True) stack.set_hexpand(True) grid.attach(stack, 0, 1, 1, 1) buttonbox = Gtk.ButtonBox() buttonbox.set_layout(Gtk.ButtonBoxStyle.CENTER) grid.attach(buttonbox, 0, 0, 1, 1) stackswitcher = Gtk.StackSwitcher() stackswitcher.set_stack(stack) grid.attach(stackswitcher, 0, 0, 1, 1) label = Gtk.Label('Stack Content on Page') name = "label" stack.add_named(label, name) for page in range(1, 4): label = Gtk.Label("Stack Content on Page %i" % (page)) name = "label%i" % page title = "Page %i" % page stack.add_titled(label, name, title) self.window.append_page(grid) self.window.set_page_complete(grid, True)
def on_show_assistant_btn_clicked(self, widget): self.assistant = gtk.Assistant() self.assistant.connect('cancel', self.on_assistant_cancel) self.assistant.connect('close', self.on_assistant_close) intro_box = gtk.ScrolledWindow() self.assistant.append_page(intro_box) self.assistant.set_page_type(intro_box, gtk.AssistantPageType.INTRO) intro_label = gtk.Label('This is an assistant.') intro_label.set_line_wrap(True) intro_box.add(intro_label) self.assistant.set_page_title(intro_box, 'Intro') self.assistant.set_page_complete(intro_box, True) # for i, chunk in enumerate(self.chunks): # box = gtk.ScrolledWindow() # label = gtk.Label(chunk) # label.set_line_wrap(True) # box.add(label) # self.assistant.append_page(box) # self.assistant.set_page_type(box, gtk.AssistantPageType.CONTENT) # self.assistant.set_page_title(box, 'Page {}'.format(i)) # self.assistant.set_page_complete(box, True) content_box = gtk.ScrolledWindow() self.assistant.append_page(content_box) self.assistant.set_page_type(content_box, gtk.AssistantPageType.CONTENT) content_label = gtk.Label('This is a content page.') content_label.set_line_wrap(True) content_box.add(content_label) self.assistant.set_page_title(content_box, 'Content') self.assistant.set_page_complete(content_box, True) summary_box = gtk.ScrolledWindow() self.assistant.append_page(summary_box) self.assistant.set_page_type(summary_box, gtk.AssistantPageType.SUMMARY) summary_label = gtk.Label('This was an assistant in action.') summary_label.set_line_wrap(True) summary_box.add(summary_label) self.assistant.set_page_title(summary_box, 'Summary') self.assistant.set_page_complete(summary_box, True) self.assistant.show_all()
def __init__(self): Gtk.Window.__init__(self) self.assistant = Gtk.Assistant() grid = Gtk.Grid(margin=4) grid.set_column_homogeneous(True) self.add(grid) self.grid = grid self.status_label, self.status_button = self.draw_status_elements() self.statistics_frame = self.draw_statistics_frame() self.top_queries_frame = self.draw_top_queries_frame() self.top_ads_frame = self.draw_top_ads_frame() self.updates_frame = self.draw_updates_frame() self.header_bar = self.draw_header_bar() self.hosts_combo = self.draw_hosts_combo() # Initial data fetch-and-display self.fetch_data_and_update_display(base_url, web_password) # Create a timer --> self.on_timer will be called periodically GLib.timeout_add_seconds(update_interval_seconds, self.on_timer)
def __init__(self, dbstate, user, options_class, name, callback=None): uistate = user.uistate tool.Tool.__init__(self, dbstate, options_class, name) ManagedWindow.__init__(self, uistate, [], self.__class__) self.callback = uistate.pulse_progressbar self.batch_ops = [] self.build_batch_ops() self.assistant = Gtk.Assistant() self.set_window(self.assistant, None, _('Media Manager')) self.setup_configs('interface.mediaman', 780, 600) help_btn = Gtk.Button.new_with_label(_('Help')) help_btn.connect('clicked', self.on_help_clicked) self.assistant.add_action_widget(help_btn) self.assistant.connect('close', self.do_close) self.assistant.connect('cancel', self.do_close) self.assistant.connect('apply', self.run) self.assistant.connect('prepare', self.prepare) intro = IntroductionPage() self.add_page(intro, Gtk.AssistantPageType.INTRO, _('Introduction')) self.selection = SelectionPage(self.batch_ops) self.add_page(self.selection, Gtk.AssistantPageType.CONTENT, _('Selection')) self.settings = SettingsPage(self.batch_ops, self.assistant) self.add_page(self.settings, Gtk.AssistantPageType.CONTENT) self.confirmation = ConfirmationPage(self.batch_ops) self.add_page(self.confirmation, Gtk.AssistantPageType.CONFIRM, _('Final confirmation')) self.conclusion = ConclusionPage(self.assistant) self.add_page(self.conclusion, Gtk.AssistantPageType.SUMMARY) self.show() self.assistant.set_forward_page_func(self.forward_page, None)
def createAssistant(self): self.assistant = gtk.Assistant() self.assistant.connect("cancel", cancel_button_clicked) self.assistant.connect("close", cancel_button_clicked) self.set_default_size(600,600) self.assistant.set_resizable(False) pages=self.generatePages(self.iso) for page in pages: box=page[0] title=page[1] pagetype=page[2] self.assistant.append_page(box) self.assistant.set_page_type(box, pagetype) self.assistant.set_page_title(box, title) self.assistant.set_page_complete(box, True) if(len(page)>3): self.box = box self.assistant.set_page_complete(box,False) changePage(self.assistant) self.assistant.show_all() self.assistant.set_forward_page_func(self.pageForward)
def close_button_clicked(assistant): print("The 'Close' button has been clicked") Gtk.main_quit() def cancel_button_clicked(assistant): print("The 'Cancel' button has been clicked") Gtk.main_quit() def checkbutton_toggled(checkbutton): assistant.set_page_complete(box1, checkbutton.get_active()) assistant = Gtk.Assistant() assistant.connect("cancel", cancel_button_clicked) assistant.connect("close", close_button_clicked) assistant.connect("apply", apply_button_clicked) box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) assistant.append_page(box) assistant.set_page_type(box, Gtk.AssistantPageType.INTRO) assistant.set_page_title(box, "Page 1: Introduction") label = Gtk.Label( label= "An 'Intro' page is the first page of an Assistant. It is used to provide information about what configuration settings need to be configured. The introduction page only has a 'Continue' button." ) label.set_line_wrap(True) box.pack_start(label, True, True, 0) assistant.set_page_complete(box, True)
import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk, GLib from our_email import * from watermark import * from certificate import * def create_label(text): e = Gtk.Label() e.set_text(text) return e c_cert_assistant = Gtk.Assistant() c_info_grid = Gtk.Grid() c_info_grid.set_row_spacing(6) c_info_grid.set_column_spacing(20) c_your_name = create_label("Your name") c_your_mail = create_label("Your email") c_their_name = create_label("Their name") c_their_mail = create_label("Their email") c_enter_your_name = Gtk.Entry() c_enter_your_mail = Gtk.Entry() c_enter_their_name = Gtk.Entry() c_enter_their_mail = Gtk.Entry() c_cert_assistant.append_page(c_info_grid) c_cert_assistant.set_page_title(c_info_grid, "Add information")