def __init__(self, *args, **kwargs): GladeDelegate.__init__(self, *args, **kwargs) self.toplevel.set_keep_above(True) self.toplevel.resize(*SellableImageViewer.size) self.toplevel.move(*SellableImageViewer.position) self.sellable = None self.toplevel.connect("configure-event", self._on_configure)
def __init__(self, title, first_step, size=None, edit_mode=False): """ Create a new PluggableWizard object. :param title: :param first_step: :param size: :param edit_mode: """ GladeDelegate.__init__(self, delete_handler=self.quit_if_last, gladefile=self.gladefile) if not isinstance(first_step, WizardStep): raise TypeError("first_step must be a WizardStep " "instance, not %r" % (first_step, )) self.set_title(title) self._current = None self._first_step = first_step self.edit_mode = edit_mode if size: self.get_toplevel().set_default_size(size[0], size[1]) self._change_step(first_step) if not self.edit_mode: self.ok_button.hide()
def __init__(self, main_label_text=None, title=" ", header_text="", size=None, hide_footer=False, delete_handler=None, help_section=None): self.enable_confirm_validation = False self._message_bar = None self._create_dialog_ui() if delete_handler is None: delete_handler = self._delete_handler GladeDelegate.__init__(self, delete_handler=delete_handler, gladefile=self.gladefile) help_section = help_section or self.help_section if help_section: self._add_help_button(help_section) # FIXME: Create more widgets lazily when needed self.set_title(title) if size: self.get_toplevel().set_size_request(*size) if main_label_text: self.main_label.set_text(main_label_text) if header_text: header_label = Gtk.Label() header_label.set_markup(header_text) self.header.add(header_label) header_label.show() if hide_footer: self.hide_footer() DialogCreateEvent.emit(self)
def __init__(self): GladeDelegate.__init__(self, "ui", toplevel_name = 'MainWindow', delete_handler = self.on_exit__activate) self.tree = self.get_widget('maintree') tree = self.tree cols = [ Column('name', title=_('Step'), data_type = str, expand = True) ] tree.set_columns(cols) tree.set_headers_visible(False) basics = tree.append(None, Step(_('Assessment'), 0)) first = tree.append(basics, Step(_('Target Information'), 1)) self.first = first tree.append(basics, Step(_('Inventory'), 2)) tree.append(basics, Step(_('Vulnerabilities'), 3)) tree.expand(basics) controls = tree.append(None, Step(_('Treatment'), 4)) self.first_control = tree.append(controls, Step(_('Control Library'), 5)) tree.append(controls, Step(_('Applied Controls'), 5)) # Open or create a file before doing much if self.db_file is None: self.open_or_new() tree.expand(controls) tree.select(self.first) icon = environ.find_resource('pixmaps', 'criskicon.png') __window = self.get_widget('MainWindow') __window.set_icon_from_file(icon)
def __init__(self, main_label_text=None, title=" ", header_text="", size=None, hide_footer=False, delete_handler=None, help_section=None): self.enable_confirm_validation = False self._message_bar = None self._create_dialog_ui() self._setup_keyactions() if delete_handler is None: delete_handler = self._delete_handler GladeDelegate.__init__(self, delete_handler=delete_handler, gladefile=self.gladefile, keyactions=self.keyactions) help_section = help_section or self.help_section if help_section: self._add_help_button(help_section) # FIXME: Create more widgets lazily when needed self.set_title(title) if size: self.get_toplevel().set_size_request(*size) if main_label_text: self.main_label.set_text(main_label_text) if header_text: header_label = gtk.Label() header_label.set_markup(header_text) self.header.add(header_label) header_label.show() if hide_footer: self.hide_footer() DialogCreateEvent.emit(self)
def __init__(self, mo): self.mo = mo GladeDelegate.__init__(self, gladefile="mo", toplevel_name='window_main') self.window_main.set_size_request(400, 500) self.tab_todos = miniorganizer.ui.TodoUI(self, self.mo) self.attach_slave("eventbox_todos", self.tab_todos) self.tab_events = miniorganizer.ui.EventUI(self, self.mo) self.attach_slave("eventbox_events", self.tab_events) self.tab_notes = miniorganizer.ui.NoteUI(self, self.mo) self.attach_slave("eventbox_notes", self.tab_notes) self.show_all() if mo.first_time: dialogs.warning('This version of MiniOrganizer is still in development. Even though it works, and can be used in everyday life, there may still be bugs in it.\n\nIf you notice such a bug, or see anything else you would like to see changed or added, please contact the author. Your feedback is greatly appreciated.'); self.menuitem_cut.set_sensitive(False) self.menuitem_copy.set_sensitive(False) self.menuitem_paste.set_sensitive(False) gtk.main()
def __init__(self, mo, event): self.mo = mo self.event = event self.end_changed = False # To keep track of wether the user has modified the To: date. self.old_alarms = self.event.get_alarms() self.new_alarms = self.old_alarms[:] GladeDelegate.__init__(self, gladefile="mo_event_edit", toplevel_name='dialog_main') # Set up the user interface self.alarms_edit_ui = miniorganizer.ui.AlarmsEditUI(self.mo, self.new_alarms, self.event, self) self.vbox_alarms.pack_start(self.alarms_edit_ui.listcontainer_alarms) self.dateedit_start = miniorganizer.ui.DateTimeEditUI(event.get_start()) self.dateedit_end = miniorganizer.ui.DateTimeEditUI(event.get_end()) self.attach_slave("eventbox_start", self.dateedit_start) self.attach_slave("eventbox_end", self.dateedit_end) # Connect signals self.dateedit_start.entry_date.connect('changed', self.dateedit_start__changed) self.dateedit_end.entry_date.connect('changed', self.dateedit_end__changed) # Fill the user interface with information notime = datetime.time(0, 0) if event.get_start().time() == notime and event.get_end().time() == notime: self.checkbutton_wholeday.set_active(True) self.summary.set_text(self.event.get_summary()) self.location.set_text(self.event.get_location()) c_buffer = self.description.get_buffer() c_inspos = c_buffer.get_insert() c_insiter = c_buffer.get_iter_at_mark(c_inspos) self.description.get_buffer().insert(c_insiter, event.get_description()) rrule = event.get_recur() if rrule: self.label_recurrence.set_text(rrule['FREQ'][0].capitalize())
def __init__(self): GladeDelegate.__init__(self, gladefile="shell.ui", delete_handler=quit_if_last) self.slave = TestSlave(self) self.attach_slave("placeholder", self.slave) self.slave.show() self.slave.focus_toplevel() # Must be done after attach
def __init__(self, window, store): self.store = store self.window = window self._sensitive_group = dict() self.help_ui = None # Each app will have its own ActionGroup prefixed with the app name, so # that menus (and other activatables) can activate actions by name (for # instance sale.new_sale) self.action_group = Gio.SimpleActionGroup() window.toplevel.insert_action_group(self.app_name, self.action_group) window._action_specs = {} # FIXME: These two should probably post-__init__, but # that breaks date_label in the calender app self._create_search() self.create_actions() GladeDelegate.__init__(self, gladefile=self.gladefile, toplevel_name=self.toplevel_name) self._attach_search() self.create_ui() domain_options = self.get_domain_options() self.window.add_domain_header(domain_options) self.create_popover(domain_options)
def __init__(self): GladeDelegate.__init__(self, delete_handler=self.on_btn_quit__clicked) # Prepare and fill the menu from XML layout self.menubar = gtk.UIManager() if gtk.pygtk_version < (2, 12): self.set_tip = gtk.Tooltips().set_tip actions = gtk.ActionGroup('Actions') actions.add_actions([ ('MenuFile', None, '_File'), ('FileNew', None, '_New', '<control>N', 'Start new project', self.on_btn_new_project__clicked), ('FileOpenProject', None, '_Open', '<control>O', 'Open project', self.on_btn_open_model__clicked), ('FileSave', None, '_Save', '<control>S', 'Save model', self.on_btn_save_model__clicked), ('FileSaveAs', None, 'Save _As', '<control><shift>s', 'Save model As', self.on_btn_save_as__clicked), ('FileExportSource', None, '_Export Source', '<control>E', 'Export model to Fortran 90 source code', self.on_btn_export_src__clicked), ('FileQuit', None, '_Quit', '<control>Q', 'Quit the program', self.on_btn_quit__clicked), ('MenuEdit', None, '_Edit'), ('MenuInsert', None, '_Insert'), ('InsertParameter', None, 'Para_meter', '<control><shift>M', 'Add a new parameter', self.on_btn_add_parameter__clicked), ('InsertLayer', None, '_Layer', '<control><shift>L', 'Add a new layer', self.on_btn_add_layer__clicked), ('InsertProcess', None, '_Process', '<control><shift>P', 'Add a new process', self.on_btn_add_process__clicked), ('InsertSpecies', None, '_Species', '<control><shift>E', 'Add a new species', self.on_btn_add_species__clicked), ('MenuHelp', None, '_Help'), ('HelpAbout', None, '_About'), ]) self.menubar.insert_action_group(actions, 0) try: mergeid = self.menubar.add_ui_from_string(MENU_LAYOUT) except gobject.GError as error: print('Building menu failed: %s' % (e, mergeid)) # Initialize the project tree, passing in the menu bar self.project_tree = GTKProject(parent=self, menubar=self.menubar) self.main_window.add_accel_group(self.menubar.get_accel_group()) self.attach_slave('overviewtree', self.project_tree) self.set_title('%s - kmos' % self.project_tree.get_name()) self.project_tree.show() wid = self.project_tree.menubar.get_widget('/MainMenuBar') self.menu_box.pack_start(wid, False, False, 0) self.menu_box.show() #self.quickbuttons.hide() self.saved_state = str(self.project_tree) # Cast initial message self.toast('Welcome!')
def __init__(self): GladeDelegate.__init__(self, gladefile="tests/simple_button", domain='kiwi', delete_handler=self.quit_if_last) self.clicks = 0
def __init__(self): GladeDelegate.__init__(self, "ui", toplevel_name='MainWindow', delete_handler=self.on_exit__activate) self.tree = self.get_widget('maintree') tree = self.tree cols = [Column('name', title=_('Step'), data_type=str, expand=True)] tree.set_columns(cols) tree.set_headers_visible(False) basics = tree.append(None, Step(_('Assessment'), 0)) first = tree.append(basics, Step(_('Target Information'), 1)) self.first = first tree.append(basics, Step(_('Inventory'), 2)) tree.append(basics, Step(_('Vulnerabilities'), 3)) tree.expand(basics) controls = tree.append(None, Step(_('Treatment'), 4)) self.first_control = tree.append(controls, Step(_('Control Library'), 5)) tree.append(controls, Step(_('Applied Controls'), 5)) # Open or create a file before doing much if self.db_file is None: self.open_or_new() tree.expand(controls) tree.select(self.first) icon = environ.find_resource('pixmaps', 'criskicon.png') __window = self.get_widget('MainWindow') __window.set_icon_from_file(icon)
def __init__(self): self.icons = {} GladeDelegate.__init__(self, gladefile="lintgtk", delete_handler=self.quit_if_last) self.setup_sourceview() self.setup_side() self.throbber_icon = Throbber(self.view.throbber) self.show_all()
def __init__(self): GladeDelegate.__init__(self, delete_handler=self.on_btn_quit__clicked) # Prepare and fill the menu from XML layout self.menubar = gtk.UIManager() if gtk.pygtk_version < (2, 12): self.set_tip = gtk.Tooltips().set_tip actions = gtk.ActionGroup('Actions') actions.add_actions([ ('MenuFile', None, '_File'), ('FileNew', None, '_New', '<control>N', 'Start new project', self.on_btn_new_project__clicked), ('FileOpenProject', None, '_Open', '<control>O', 'Open project', self.on_btn_open_model__clicked), ('FileSave', None, '_Save', '<control>S', 'Save model', self.on_btn_save_model__clicked), ('FileSaveAs', None, 'Save _As', '<control><shift>s', 'Save model As', self.on_btn_save_as__clicked), ('FileExportSource', None, '_Export Source', '<control>E', 'Export model to Fortran 90 source code', self.on_btn_export_src__clicked), ('FileQuit', None, '_Quit', '<control>Q', 'Quit the program', self.on_btn_quit__clicked), ('MenuEdit', None, '_Edit'), ('MenuInsert', None, '_Insert'), ('InsertParameter', None, 'Para_meter', '<control><shift>M', 'Add a new parameter', self.on_btn_add_parameter__clicked), ('InsertLayer', None, '_Layer', '<control><shift>L', 'Add a new layer', self.on_btn_add_layer__clicked), ('InsertProcess', None, '_Process', '<control><shift>P', 'Add a new process', self.on_btn_add_process__clicked), ('InsertSpecies', None, '_Species', '<control><shift>E', 'Add a new species', self.on_btn_add_species__clicked), ('MenuHelp', None, '_Help'), ('HelpAbout', None, '_About'), ]) self.menubar.insert_action_group(actions, 0) try: mergeid = self.menubar.add_ui_from_string(menu_layout) except gobject.GError as error: print('Building menu failed: %s, %s' % (error, mergeid)) # Initialize the project tree, passing in the menu bar self.project_tree = GTKProject(parent=self, menubar=self.menubar) self.main_window.add_accel_group(self.menubar.get_accel_group()) self.attach_slave('overviewtree', self.project_tree) self.set_title('%s - kmcos' % self.project_tree.get_name()) self.project_tree.show() wid = self.project_tree.menubar.get_widget('/MainMenuBar') self.menu_box.pack_start(wid, False, False, 0) self.menu_box.show() #self.quickbuttons.hide() self.saved_state = str(self.project_tree) # Cast initial message self.toast('Welcome!')
def __init__(self, mo, text): self.mo = mo GladeDelegate.__init__(self, gladefile="mo_error_display", toplevel_name='dialog_main') c_buffer = self.textview_details.get_buffer() c_inspos = c_buffer.get_insert() c_insiter = c_buffer.get_iter_at_mark(c_inspos) self.textview_details.get_buffer().insert(c_insiter, text)
def __init__(self): GladeDelegate.__init__(self, gladefile=self.gladeFile) wtree = self.get_glade_adaptor() wtree.signal_autoconnect(self) self.widgets = {} for widget in wtree.get_widgets(): self.widgets[widget.get_name()] = widget self._window = self.widgets[self.toplevel_name]
def __init__(self, title=None): self.keyactions = {gtk.keysyms.Escape: self.on_escape_pressed} GladeDelegate.__init__(self, gladefile=self.gladefile, keyactions=self.keyactions, delete_handler=gtk.main_quit) if title: self.set_title(title) self.get_toplevel().set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DIALOG) self.setup_widgets()
def __init__(self, mo, journal): self.mo = mo self.journal = journal GladeDelegate.__init__(self, gladefile="mo_note_edit", toplevel_name='dialog_main') # Set up the user interface self.entry_title.set_text(self.journal.get_summary()) self.textview_description.get_buffer().set_text(self.journal.get_description())
def __init__(self, title=None): self.keyactions = {Gdk.KEY_Escape: self.on_escape_pressed} GladeDelegate.__init__(self, gladefile=self.gladefile, keyactions=self.keyactions, delete_handler=Gtk.main_quit) if title: self.set_title(title) self.get_toplevel().set_type_hint(Gdk.WindowTypeHint.DIALOG) self.setup_widgets()
def __init__(self): GladeDelegate.__init__(self, gladefile="pydoku", delete_handler=self.quit_if_last) self.setup_wikitree() self.setup_attachments() self.setup_side() self.setup_sourceview() self.setup_htmlview() self.page_edit = self.view.notebook1.get_nth_page(0) self.page_view = self.view.notebook1.get_nth_page(1) self.page_attach = self.view.notebook1.get_nth_page(2) self.show_all()
def __init__(self): GladeDelegate.__init__(self, gladefile="personalinformation.ui", delete_handler=self.quit_if_last) self.nationality.prefill(['Brazilian', 'Yankee', 'Other']) self.gender.prefill(('Male', 'Female')) self.age.set_mask('00') self.register_validate_function(self.validity) # XXX: Get rid of this self.force_validation()
def __init__(self, label='', pulse=True): """ Create a new ProgressDialog object. :param label: initial content of the label """ GladeDelegate.__init__(self, gladefile=self.gladefile) self.set_title(label) self._pulse = pulse self._timeout_id = -1 self._start_id = -1 self.label.set_label(label) self.toplevel.set_position(gtk.WIN_POS_CENTER)
def __init__(self, lists): self.lists = lists self.l = lists.pop(0) self._load_stats() gladefile = pkg_resources.resource_filename('gla', 'data/browser.ui') GladeDelegate.__init__(self, gladefile=gladefile, delete_handler=self.quit_if_last) self.proxy = None self.msg = None self.setup_widgets() self.update_list()
def __init__(self, size): """ :param tuple size: the size for this viewer as (x, y) """ self._size = size GladeDelegate.__init__(self) self.toplevel.set_keep_above(True) self.toplevel.resize(*self._size) self.toplevel.move(*self.position) self.sellable = None self.toplevel.connect("configure-event", self._on_configure)
def __init__(self): GladeDelegate.__init__(self, gladefile="interface.ui", delete_handler=self.quit_if_last) self.proxy = None self.db = create_database("sqlite:laps.sqlite") self.store = Store(self.db) self.race = self._check_race() self.race_proxy = self.add_proxy(self.race, self.race_widgets) self.register_validate_function(self._validation_changed) self._check_categories() self.setup_widgets()
def __init__(self): GladeDelegate.__init__(self, gladefile="personalinformation.ui", delete_handler=self.quit_if_last) self.nationality.prefill([u'Brazilian', u'Yankee', u'Other']) self.gender.prefill([u'Male', u'Female']) self.age.set_mask('00') self.register_validate_function(self.validity) # XXX: Get rid of this self.force_validation()
def __init__(self): GladeDelegate.__init__(self, gladefile='lang.ui', delete_handler=self.quit_if_last) self.register_validate_function(self.validity) hb = Gtk.HeaderBar() hb.set_title('Foobar') hb.set_show_close_button(True) button = Gtk.Button() icon = Gio.ThemedIcon(name="mail-send-receive-symbolic") image = Gtk.Image.new_from_gicon(icon, Gtk.IconSize.BUTTON) button.add(image) hb.pack_end(button) self.toplevel.set_titlebar(hb)
def __init__(self, window, store=None): if store is None: store = api.get_default_store() self.store = store self.window = window self._loading_filters = False self._sensitive_group = dict() self.help_ui = None self.uimanager = self.window.uimanager self._pre_init() GladeDelegate.__init__(self, gladefile=self.gladefile, toplevel_name=self.toplevel_name) self._post_init()
def __init__(self, mo, alarm, start_time): self.mo = mo self.alarm = alarm self.start_time = start_time self.old_delta = self.alarm.get_delta() GladeDelegate.__init__(self, gladefile="mo_alarm_edit", toplevel_name='dialog_main') days, hours, minutes, seconds = self.alarm.get_offset() self.entry_days.set_text(str(days)) self.entry_hours.set_text(str(hours)) self.entry_minutes.set_text(str(minutes)) self.entry_days.connect('changed', self.trigger_on_update) self.entry_hours.connect('changed', self.trigger_on_update) self.entry_minutes.connect('changed', self.trigger_on_update) self.trigger_on_update()
def __init__(self, window, store=None): if store is None: store = api.get_default_store() self.store = store self.window = window self._sensitive_group = dict() self.help_ui = None self.uimanager = self.window.uimanager # FIXME: These two should probably post-__init__, but # that breaks date_label in the calender app self._create_search() self.create_actions() GladeDelegate.__init__(self, gladefile=self.gladefile, toplevel_name=self.toplevel_name) self._attach_search() self.create_ui()
def __init__(self, mo, event): self.mo = mo self.event = event self.snooze_delta = None label_text = "<b>%s</b>\n%s" % (event.get_summary(), event.get_description()) GladeDelegate.__init__(self, gladefile="mo_reminder", toplevel_name='dialog_main') self.get_toplevel().set_modal(True) self.get_toplevel().stick() self.get_toplevel().set_keep_above(True) self.entry_snoozetime.set_text(str(mo.config['reminder.default_snooze'])) self.label_summary.set_label('<span size=\'large\'><b>%s</b></span>' % (event.get_summary())) self.label_from.set_text(event.get_start().ctime()) self.label_to.set_text(event.get_end().ctime()) self.label_description.set_text('%s' % (event.get_description())) if getattr(event, 'get_location'): self.label_location.set_text(event.get_location())
def __init__(self): keyactions = { Gdk.KEY_a: self.on_ok__clicked, Gdk.KEY_b: self.on_cancel__clicked, } GladeDelegate.__init__(self, gladefile="news_shell.ui", delete_handler=quit_if_last, keyactions=keyactions) # paint header and footer; they are eventboxes that hold a # label and buttonbox respectively set_background(self.header, "white") set_background(self.footer, "#A0A0A0") set_foreground(self.title, "blue") self.slave = ListSlave(self) self.attach_slave("placeholder", self.slave) self.slave.show() self.slave.focus_toplevel() # Must be done after attach
def __init__(self): keyactions = { gtk.keysyms.a: self.on_ok__clicked, gtk.keysyms.b: self.on_cancel__clicked, } GladeDelegate.__init__(self, gladefile="news_shell.ui", delete_handler=quit_if_last, keyactions=keyactions) # paint header and footer; they are eventboxes that hold a # label and buttonbox respectively set_background(self.header, "white") set_background(self.footer, "#A0A0A0") set_foreground(self.title, "blue") self.slave = ListSlave(self) self.attach_slave("placeholder", self.slave) self.slave.show() self.slave.focus_toplevel() # Must be done after attach
def __init__(self): GladeDelegate.__init__(self, gladefile="pydoku", delete_handler=self.quit_if_last) self._icons = {} self.throbber_icon = Throbber(self.view.throbber) self.setup_wikitree() self.setup_wikislist() self.setup_attachments() self.setup_lastchanges() self.setup_side() self.setup_sourceview() self.setup_htmlview() self.page_edit = self.view.notebook1.get_nth_page(0) self.page_view = self.view.notebook1.get_nth_page(1) self.page_attach = self.view.notebook1.get_nth_page(2) self.show_all() if len(cfg.getChildren()): wiki = cfg.getChildren()[0] self.connect(wiki.url, wiki.user, wiki.password) self.wiki = wiki if wiki.current: self.load_page(wiki.current)
def __init__(self, options, shell, store): """Creates a new window :param options: optparse options :param shell: the shell :param store: a store """ self._action_groups = {} self._help_ui = None self._osx_app = None self.current_app = None self.current_app_widget = None self.shell = shell self.uimanager = Gtk.UIManager() self.in_ui_test = False self.tool_items = [] self.options = options self.store = store self._pre_launcher_init() GladeDelegate.__init__(self, gladefile=self.gladefile) self._create_ui() self._launcher_ui_bootstrap()
def __init__(self, options, shell, store): """Creates a new window :param options: optparse options :param shell: the shell :param store: a store """ self._action_groups = {} self._help_ui = None self._osx_app = None self.current_app = None self.current_app_widget = None self.shell = shell self.uimanager = gtk.UIManager() self.in_ui_test = False self.tool_items = [] self.options = options self.store = store self._pre_launcher_init() GladeDelegate.__init__(self, gladefile=self.gladefile) self._create_ui() self._launcher_ui_bootstrap()
def __init__(self, title, first_step, size=None, edit_mode=False): """ Create a new PluggableWizard object. @param title: @param first_step: @param size: @param edit_mode: """ GladeDelegate.__init__(self, delete_handler=self.quit_if_last, gladefile=self.gladefile) if not isinstance(first_step, WizardStep): raise TypeError("first_step must be a WizardStep instance") self.set_title(title) self._current = None self._first_step = first_step self.edit_mode = edit_mode if size: self.get_toplevel().set_default_size(size[0], size[1]) self._change_step(first_step) if not self.edit_mode: self.ok_button.hide()
def __init__(self): x = GladeDelegate.__init__(self, gladefile="mo_about", toplevel_name='dialog_main') self.toplevel.connect('response', self.on_close) self.show_all()
def __init__(self): GladeDelegate.__init__(self, gladefile='lang.ui', delete_handler=self.quit_if_last) self.register_validate_function(self.validity)