def init_ui(self): BaseDialog.init_ui(self) self.contributors = ListBoxContributors() self.contributors.set_size_request(300, 500) self.grid.attach(self.contributors, 0, 0, 1, 1) box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 5) self.grid.attach(box, 1, 0, 1, 2) button_add = Gtk.Button.new_with_label(_('Add contributor')) button_add.connect('clicked', self.on_button_add_clicked) box.add(button_add) button_edit = Gtk.Button.new_with_label(_('Edit contributor')) button_edit.connect('clicked', self.on_button_edit_clicked) box.add(button_edit) button_remove = Gtk.Button.new_with_label(_('Remove contributor')) button_remove.connect('clicked', self.on_button_remove_clicked) box.add(button_remove) button_clear = Gtk.Button.new_with_label(_('Clear contributor')) button_clear.connect('clicked', self.on_button_clear_clicked) box.add(button_clear)
def init_ui(self): BaseDialog.init_ui(self) notebook = Gtk.Notebook.new() self.grid.attach(notebook, 0, 0, 1, 1) self.boxGeneral = BoxGeneral() notebook.append_page(self.boxGeneral, Gtk.Label.new(_('General'))) self.boxDescription = BoxText(_('Description:'), True) notebook.append_page(self.boxDescription, Gtk.Label.new(_('Description'))) self.boxDependencies = BoxText(_('Prerequisites:'), True) notebook.append_page(self.boxDependencies, Gtk.Label.new(_('Prerequisites'))) self.boxInstalling = BoxText(_('Installing:'), True) notebook.append_page(self.boxInstalling, Gtk.Label.new(_('Installing'))) self.boxUsing = BoxText(_('Using:'), True) notebook.append_page(self.boxUsing, Gtk.Label.new(_('Using'))) self.boxContributing = BoxText(_('Contibuting:'), True) notebook.append_page(self.boxContributing, Gtk.Label.new(_('Contributing'))) self.boxContributors = BoxContributors(_('Contributors:'), True) notebook.append_page(self.boxContributors, Gtk.Label.new(_('Contributors'))) self.init_headbar()
def init_ui(self): BaseDialog.init_ui(self) self.grid.set_row_spacing(0) self.grid.set_column_spacing(0) forecast = self.weather['forecasts'] self.table = Gtk.Table(rows=9, columns=5, homogeneous=False) self.table.set_col_spacings(10) self.create_labels() if self.ws == 'yahoo': total = 2 if self.ws == 'wunderground': total = 4 else: total = 5 for i in range(0, total): self.create_forecast_dor_day(forecast, i) if self.ws == 'yahoo': filename = comun.YAHOOLOGO web = comun.YAHOOWEB elif self.ws == 'worldweatheronline': filename = comun.WOLRDWEATHERONLINE web = comun.WOLRDWEATHERONLINEWEB elif self.ws == 'openweathermap': filename = comun.OPENWEATHERMAPLOGO web = comun.OPENWEATHERMAPWEB elif self.ws == 'wunderground': filename = comun.UNDERGROUNDLOGO web = comun.UNDERGROUNDWEB image = load_image(filename, size=64) image.set_alignment(0.5, 0.5) button = Gtk.Button() button.set_image(image) button.connect('clicked', (lambda x: webbrowser.open(web)))
def init_ui(self): BaseDialog.init_ui(self) label = Gtk.Label.new(_('Tag name:')) label.set_property('halign', Gtk.Align.START) self.grid.attach(label, 0, 0, 1, 1) self.text = Gtk.Entry.new() self.grid.attach(self.text, 1, 0, 1, 1) label = Gtk.Label.new(_('Type:')) label.set_property('halign', Gtk.Align.START) self.grid.attach(label, 0, 1, 1, 1) type_store = Gtk.ListStore(str, str) type_store.append([_('Boolean'), 'boolean']) type_store.append([_('Date'), 'date']) type_store.append([_('String'), 'string']) self.type = Gtk.ComboBox.new() self.type.set_model(type_store) cell1 = Gtk.CellRendererText() self.type.pack_start(cell1, True) self.type.add_attribute(cell1, 'text', 0) self.grid.attach(self.type, 1, 1, 1, 1)
def init_ui(self): BaseDialog.init_ui(self) self.grid.attach(Gtk.Label.new(_('Theme light:')), 0, 0, 1, 1) self.theme_light = Gtk.Switch.new() self.grid.attach(self.theme_light, 1, 0, 1, 1) self.grid.attach(Gtk.Label.new(_('Start actived:')), 0, 1, 1, 1) self.start_actived = Gtk.Switch.new() self.grid.attach(self.start_actived, 1, 1, 1, 1) self.grid.attach(Gtk.Label.new(_('Autostart:')), 0, 2, 1, 1) self.autostart = Gtk.Switch.new() self.grid.attach(self.autostart, 1, 2, 1, 1) self.grid.attach(Gtk.Label.new(_('Colors')), 0, 3, 2, 1) self.grid.attach(Gtk.Label.new(_('Distance')), 0, 4, 1, 1) color = Gdk.RGBA() color.parse('#445c3c') self.distance_color = Gtk.ColorButton() self.grid.attach(self.distance_color, 1, 4, 1, 1) self.grid.attach(Gtk.Label.new(_('Clics')), 0, 5, 1, 1) color.parse('#445c3c') self.clics_color = Gtk.ColorButton.new_with_rgba(color) self.grid.attach(self.clics_color, 1, 5, 1, 1) self.grid.attach(Gtk.Label.new(_('Keys')), 0, 6, 1, 1) color.parse('#445c3c') self.keys_color = Gtk.ColorButton() self.keys_color.set_rgba(color) self.grid.attach(self.keys_color, 1, 6, 1, 1)
def init_ui(self): BaseDialog.init_ui(self) label = Gtk.Label.new(_("Tag name:")) label.set_property("halign", Gtk.Align.START) self.grid.attach(label, 0, 0, 1, 1) self.text = Gtk.Entry.new() self.grid.attach(self.text, 1, 0, 1, 1) label = Gtk.Label.new(_("Type:")) label.set_property("halign", Gtk.Align.START) self.grid.attach(label, 0, 1, 1, 1) type_store = Gtk.ListStore(str, str) type_store.append([_("Boolean"), "boolean"]) type_store.append([_("Date"), "date"]) type_store.append([_("String"), "string"]) self.type = Gtk.ComboBox.new() self.type.set_model(type_store) cell1 = Gtk.CellRendererText() self.type.pack_start(cell1, True) self.type.add_attribute(cell1, "text", 0) self.grid.attach(self.type, 1, 1, 1, 1)
def init_ui(self): BaseDialog.init_ui(self) label = Gtk.Label.new(_('Context name:')) label.set_property('halign', Gtk.Align.START) self.grid.attach(label, 0, 0, 1, 1) self.text = Gtk.Entry.new() self.grid.attach(self.text, 1, 0, 1, 1)
def init_ui(self): BaseDialog.init_ui(self) label = Gtk.Label.new(_("Project name:")) label.set_property("halign", Gtk.Align.START) self.grid.attach(label, 0, 0, 1, 1) self.text = Gtk.Entry.new() self.text.set_hexpand(True) self.grid.attach(self.text, 1, 0, 1, 1)
def init_ui(self): BaseDialog.init_ui(self) self.notebook = Gtk.Notebook.new() self.grid.attach(self.notebook, 0, 0, 1, 1) self._build_page_general() self._build_page_projects() self._build_page_contexts() self._build_tags() self._build_behaviors()
def init_ui(self): BaseDialog.init_ui(self) self.grid.attach(LeftLabel(_('Message:')), 0, 0, 1, 1) frame = Gtk.Frame() scroll = Gtk.ScrolledWindow() scroll.set_hexpand(True) scroll.set_border_width(3) self.message = Gtk.TextView.new() scroll.add(self.message) frame.add(scroll) frame.set_size_request(400, 200) self.grid.attach(frame, 0, 1, 2, 2)
def init_ui(self): BaseDialog.init_ui(self) scrolledwindow = Gtk.ScrolledWindow() scrolledwindow.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) self.grid.attach(scrolledwindow, 0, 0, 1, 1) self.viewer = WebKit2.WebView() scrolledwindow.add(self.viewer) scrolledwindow.set_size_request(900, 600) self.viewer.connect('load-changed', self.load_changed) self.viewer.load_uri('file://' + comun.HTML) self.set_focus(self.viewer)
def init_ui(self): BaseDialog.init_ui(self) label = Gtk.Label.new(_('Nick name:')) label.set_property('halign', Gtk.Align.START) self.grid.attach(label, 0, 0, 1, 1) self.nickname = Gtk.Entry.new() self.grid.attach(self.nickname, 1, 0, 1, 1) button_import = Gtk.Button.new_with_label(_('Import from GitHub')) button_import.connect('clicked', self.on_button_import_clicked) self.grid.attach(button_import, 0, 1, 2, 1) label = Gtk.Label.new(_('Name:')) label.set_property('halign', Gtk.Align.START) self.grid.attach(label, 0, 2, 1, 1) self.name = Gtk.Entry.new() self.grid.attach(self.name, 1, 2, 1, 1) label = Gtk.Label.new(_('Url:')) label.set_property('halign', Gtk.Align.START) self.grid.attach(label, 0, 3, 1, 1) self.url = Gtk.Entry.new() self.grid.attach(self.url, 1, 3, 1, 1) label = Gtk.Label.new(_('Avatar url:')) label.set_property('halign', Gtk.Align.START) self.grid.attach(label, 0, 4, 1, 1) self.avatar_url = Gtk.Entry.new() self.grid.attach(self.avatar_url, 1, 4, 1, 1) label = Gtk.Label.new(_('Role')) label.set_property('halign', Gtk.Align.START) self.grid.attach(label, 0, 5, 1, 1) role_store = Gtk.ListStore(str, str) role_store.append(['🐛 - {}'.format(_('Bug')), '🐛']) role_store.append(['💻 - {}'.format(_('Code')), '💻']) role_store.append(['🎨 - {}'.format(_('Design')), '🎨']) role_store.append(['📖 - {}'.format(_('Documentation')), '📖']) role_store.append(['🤔 - {}'.format(_('Ideas')), '🤔']) role_store.append(['🌍 - {}'.format(_('Translation')), '🌍']) self.role = Gtk.ComboBox.new() self.role.set_model(role_store) cell1 = Gtk.CellRendererText() self.role.pack_start(cell1, True) self.role.add_attribute(cell1, 'text', 0) self.grid.attach(self.role, 1, 5, 1, 1)
def init_ui(self): BaseDialog.init_ui(self) self.scrolledwindow1 = Gtk.ScrolledWindow() self.scrolledwindow1.set_policy( Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC ) self.grid.attach(self.scrolledwindow1, 0, 0, 1, 1) self.viewer = WebKit2.WebView() self.scrolledwindow1.add(self.viewer) self.scrolledwindow1.set_size_request(1300, 600) self.viewer.load_uri("file://" + config.HTML_GRAPH) self.viewer.connect("load-changed", self.load_changed) self.set_focus(self.viewer)
def init_ui(self): BaseDialog.init_ui(self) label_waiting = Gtk.Label.new(_('Capturing new keybind')) label_waiting.set_property('halign', Gtk.Align.START) label_waiting.set_property('can_focus', False) self.grid.attach(label_waiting, 0, 0, 1, 1) self.key_pressed = [] self.key_unpressed = [] self.shortcut_hits = 0 self.label = Gtk.Label(label="") self.update_label_text() self.grid.attach(self.label, 0, 1, 1, 1) self.connect("key-press-event", self.on_key_press_event) self.connect("key-release-event", self.on_key_release_event)
def init_ui(self): BaseDialog.init_ui(self) self.grid.attach(Gtk.Label.new(_('Theme light:')), 0, 0, 1, 1) self.theme_light = Gtk.Switch.new() self.grid.attach(self.theme_light, 1, 0, 1, 1) self.grid.attach(Gtk.Label.new(_('Start actived:')), 0, 1, 1, 1) self.start_actived = Gtk.Switch.new() self.grid.attach(self.start_actived, 1, 1, 1, 1) self.grid.attach(Gtk.Label.new(_('Autostart:')), 0, 2, 1, 1) self.autostart = Gtk.Switch.new() self.grid.attach(self.autostart, 1, 2, 1, 1) self.grid.attach(Gtk.Separator(), 0, 3, 2, 1) label = Gtk.Label(_('Units')) label.set_alignment(0, 0.5) self.grid.attach(label, 0, 4, 1, 1) units_store = Gtk.ListStore(str, str) units_store.append([_('meters'), 'meters']) units_store.append([_('feets'), 'feets']) self.units = Gtk.ComboBox.new() self.units.set_model(units_store) cell1 = Gtk.CellRendererText() self.units.pack_start(cell1, True) self.units.add_attribute(cell1, 'text', 0) self.grid.attach(self.units, 1, 4, 1, 1) self.grid.attach(Gtk.Separator(), 0, 5, 2, 1) self.grid.attach(Gtk.Label.new(_('Colors')), 0, 6, 2, 1) self.grid.attach(Gtk.Label.new(_('Distance')), 0, 7, 1, 1) color = Gdk.RGBA() color.parse('#445c3c') self.distance_color = Gtk.ColorButton() self.grid.attach(self.distance_color, 1, 7, 1, 1) self.grid.attach(Gtk.Label.new(_('Clicks')), 0, 8, 1, 1) color.parse('#445c3c') self.clics_color = Gtk.ColorButton.new_with_rgba(color) self.grid.attach(self.clics_color, 1, 8, 1, 1) self.grid.attach(Gtk.Label.new(_('Keys')), 0, 9, 1, 1) color.parse('#445c3c') self.keys_color = Gtk.ColorButton() self.keys_color.set_rgba(color) self.grid.attach(self.keys_color, 1, 9, 1, 1)
def init_ui(self): BaseDialog.init_ui(self) self.grid.attach(LeftLabel(_('HTTPS Protocol:')), 0, 0, 1, 1) self.https_protocol = Gtk.Switch.new() self.https_protocol.set_halign(Gtk.Align.START) self.grid.attach(self.https_protocol, 1, 0, 1, 1) self.grid.attach(LeftLabel(_('Base url (without protocol):')), 0, 1, 1, 1) self.base_url = Gtk.Entry.new() self.grid.attach(self.base_url, 1, 1, 1, 1) self.grid.attach(Gtk.Separator(), 0, 2, 2, 1) self.grid.attach(LeftLabel(_('Application name')), 0, 3, 1, 1) self.application_name = Gtk.Entry.new() self.grid.attach(self.application_name, 1, 3, 1, 1) self.grid.attach(LeftLabel(_('Application token:')), 0, 4, 1, 1) self.application_token = Gtk.Entry.new() self.grid.attach(self.application_token, 1, 4, 1, 1) self.grid.attach(Gtk.Separator(), 0, 5, 2, 1) self.grid.attach(LeftLabel(_('Client token:')), 0, 6, 1, 1) self.client_token = Gtk.Entry.new() self.grid.attach(self.client_token, 1, 6, 1, 1) self.grid.attach(Gtk.Separator(), 0, 7, 2, 1) self.grid.attach(LeftLabel(_('Theme light:')), 0, 8, 1, 1) self.theme_light = Gtk.Switch.new() self.theme_light.set_halign(Gtk.Align.START) self.grid.attach(self.theme_light, 1, 8, 1, 1) self.grid.attach(LeftLabel(_('Autostart:')), 0, 9, 1, 1) self.autostart = Gtk.Switch.new() self.autostart.set_halign(Gtk.Align.START) self.grid.attach(self.autostart, 1, 9, 1, 1)
def init_ui(self): BaseDialog.init_ui(self) label = Gtk.Label.new(_("Text:")) label.set_property("halign", Gtk.Align.START) self.grid.attach(label, 0, 0, 1, 1) self.text = Gtk.Entry.new() self.text.set_hexpand(True) self.grid.attach(self.text, 1, 0, 1, 1) label = Gtk.Label.new(_("Priority")) label.set_property("halign", Gtk.Align.START) self.grid.attach(label, 0, 1, 1, 1) priority_store = Gtk.ListStore(str, int) priority_store.append(["-", -1]) for i in range(0, 26): priority_store.append([chr(i + 65), i]) self.priority = Gtk.ComboBox.new() self.priority.set_model(priority_store) cell1 = Gtk.CellRendererText() self.priority.pack_start(cell1, True) self.priority.add_attribute(cell1, "text", 0) self.grid.attach(self.priority, 1, 1, 1, 1) configuration = Configuration() preferences = configuration.get("preferences") projects = preferences["projects"] contexts = preferences["contexts"] tags = preferences["tags"] show_hidden_tags = preferences["show-hidden-tags"] self.editable_hidden_tags = show_hidden_tags posv = 1 self.projects = None self.contexts = None self.tags = [] if projects: posv += 1 label = Gtk.Label.new(_("Select project(s):")) label.set_halign(Gtk.Align.START) label.set_valign(Gtk.Align.START) self.grid.attach(label, 0, posv, 1, 1) self.projects = ListBoxCheck(projects) self.projects.set_min_content_height(75) self.projects.set_vexpand(True) self.grid.attach(self.projects, 1, posv, 1, 1) if contexts: posv += 1 label = Gtk.Label.new(_("Select context(s):")) label.set_halign(Gtk.Align.START) label.set_valign(Gtk.Align.START) self.grid.attach(label, 0, posv, 1, 1) self.contexts = ListBoxCheck(contexts) self.contexts.set_vexpand(True) self.contexts.set_min_content_height(75) self.grid.attach(self.contexts, 1, posv, 1, 1) for tag in tags: if (tag["name"] in ("started_at", "total_time") and not show_hidden_tags): continue posv += 1 label = Gtk.Label.new(tag["name"] + ": ") label.set_halign(Gtk.Align.START) self.grid.attach(label, 0, posv, 1, 1) if tag["type"] == "date": label.set_valign(Gtk.Align.START) tag_widget = CheckCalendar() elif tag["type"] == "boolean": tag_widget = Gtk.CheckButton.new() else: tag_widget = Gtk.Entry.new() tag_widget.name = tag["name"] self.tags.append(tag_widget) self.grid.attach(self.tags[len(self.tags) - 1], 1, posv, 1, 1)
def init_ui(self): BaseDialog.init_ui(self) label = Gtk.Label.new(_('Text:')) label.set_property('halign', Gtk.Align.START) self.grid.attach(label, 0, 0, 1, 1) self.text = Gtk.Entry.new() self.grid.attach(self.text, 1, 0, 1, 1) label = Gtk.Label.new(_('Priority')) label.set_property('halign', Gtk.Align.START) self.grid.attach(label, 0, 1, 1, 1) priority_store = Gtk.ListStore(str, int) priority_store.append(['-', -1]) for i in range(0, 26): priority_store.append([chr(i + 65), i]) self.priority = Gtk.ComboBox.new() self.priority.set_model(priority_store) cell1 = Gtk.CellRendererText() self.priority.pack_start(cell1, True) self.priority.add_attribute(cell1, 'text', 0) self.grid.attach(self.priority, 1, 1, 1, 1) configuration = Configuration() preferences = configuration.get('preferences') projects = preferences['projects'] contexts = preferences['contexts'] tags = preferences['tags'] posv = 1 self.projects = None self.contexts = None self.tags = [] if projects: posv += 1 label = Gtk.Label.new(_('Select project(s):')) label.set_halign(Gtk.Align.START) label.set_valign(Gtk.Align.START) self.grid.attach(label, 0, posv, 1, 1) self.projects = ListBoxCheck(projects) self.projects.set_min_content_height(75) self.grid.attach(self.projects, 1, posv, 1, 1) if contexts: posv += 1 label = Gtk.Label.new(_('Select context(s):')) label.set_halign(Gtk.Align.START) label.set_valign(Gtk.Align.START) self.grid.attach(label, 0, posv, 1, 1) self.contexts = ListBoxCheck(contexts) self.contexts.set_min_content_height(75) self.grid.attach(self.contexts, 1, posv, 1, 1) for tag in tags: if tag['name'] in ('started_at', 'total_time'): continue posv += 1 label = Gtk.Label.new(tag['name'] + ': ') label.set_halign(Gtk.Align.START) self.grid.attach(label, 0, posv, 1, 1) if tag['type'] == 'date': label.set_valign(Gtk.Align.START) tag_widget = CheckCalendar() elif tag['type'] == 'boolean': tag_widget = Gtk.CheckButton.new() else: tag_widget = Gtk.Entry.new() tag_widget.name = tag['name'] self.tags.append(tag_widget) self.grid.attach(self.tags[len(self.tags) - 1], 1, posv, 1, 1)
def init_ui(self): BaseDialog.init_ui(self) # vbox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 5) self.grid.attach(vbox, 0, 0, 1, 1) hbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 5) vbox.pack_start(hbox, False, False, 0) # self.entry1 = Gtk.Entry() self.entry1.set_width_chars(60) self.entry1.set_property('primary_icon_name', 'edit-find-symbolic') self.entry1.set_property('secondary_icon_name', 'edit-clear-symbolic') self.entry1.set_property('primary_icon_tooltip_text', _('Search location')) self.entry1.set_property('secondary_icon_tooltip_text', _('Clear location')) self.entry1.set_tooltip_text(_('Input the name of your city')) self.entry1.connect('icon-press', self.on_icon_press) self.entry1.connect('activate', self.on_button1_clicked) hbox.pack_start(self.entry1, True, True, 0) # button1 = Gtk.Button.new_with_label(_('Search')) button1.connect('clicked', self.on_button1_clicked) hbox.pack_start(button1, False, False, 0) # button2 = Gtk.Button.new_with_label(_('Find me')) button2.connect('clicked', self.on_button2_clicked) hbox.pack_start(button2, False, False, 0) self.expander = Gtk.Expander(label=_('Locations found')) self.expander.set_expanded(False) vbox.pack_start(self.expander, False, False, 0) # frame = Gtk.Frame() framebox = Gtk.Box.new(Gtk.Orientation.VERTICAL, 50) framebox.add(frame) self.expander.add(framebox) self.expander.connect("notify::expanded", self.on_expander_expanded) # scrolledwindow0 = Gtk.ScrolledWindow() scrolledwindow0.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) scrolledwindow0.set_shadow_type(Gtk.ShadowType.ETCHED_OUT) scrolledwindow0.set_size_request(450, 100) frame.add(scrolledwindow0) # city, county, country, latitude, longitude store = Gtk.ListStore(str, str, str, float, float) store.set_sort_column_id(2, Gtk.SortType.ASCENDING) self.treeview = Gtk.TreeView(model=store) self.treeview.set_reorderable(True) treeviewcolumn0 = Gtk.TreeViewColumn(_('City'), Gtk.CellRendererText(), text=0) treeviewcolumn0.set_reorderable(True) treeviewcolumn0.set_sort_column_id(0) treeviewcolumn1 = Gtk.TreeViewColumn(_('State'), Gtk.CellRendererText(), text=1) treeviewcolumn1.set_reorderable(True) treeviewcolumn1.set_sort_column_id(1) treeviewcolumn2 = Gtk.TreeViewColumn(_('Country'), Gtk.CellRendererText(), text=2) treeviewcolumn2.set_reorderable(True) treeviewcolumn2.set_sort_column_id(2) self.treeview.append_column(treeviewcolumn0) self.treeview.append_column(treeviewcolumn1) self.treeview.append_column(treeviewcolumn2) self.treeview.connect('cursor-changed', self.ontreeviewcursorchanged) scrolledwindow0.add(self.treeview) # # scrolledwindow = Gtk.ScrolledWindow() scrolledwindow.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) scrolledwindow.set_shadow_type(Gtk.ShadowType.IN) vbox.pack_start(scrolledwindow, True, True, 0) # self.viewer = OsmGpsMap.Map() self.viewer.layer_add( OsmGpsMap.MapOsd(show_dpad=True, show_zoom=True, show_crosshair=True)) # connect keyboard shortcuts self.viewer.set_keyboard_shortcut(OsmGpsMap.MapKey_t.FULLSCREEN, Gdk.keyval_from_name("F11")) self.viewer.set_keyboard_shortcut(OsmGpsMap.MapKey_t.UP, Gdk.keyval_from_name("Up")) self.viewer.set_keyboard_shortcut(OsmGpsMap.MapKey_t.DOWN, Gdk.keyval_from_name("Down")) self.viewer.set_keyboard_shortcut(OsmGpsMap.MapKey_t.LEFT, Gdk.keyval_from_name("Left")) self.viewer.set_keyboard_shortcut(OsmGpsMap.MapKey_t.RIGHT, Gdk.keyval_from_name("Right")) scrolledwindow.add(self.viewer) scrolledwindow.set_size_request(550, 550) if self.latitude and self.longitude: if self.location is not None and len(self.location) > 0: self.entry1.set_text(self.location) else: self.do_search_location(self.latitude, self.longitude) else: self.search_location2() self.set_wait_cursor() self.search_string = '' print('============================') print(self.location, self.latitude, self.longitude) print('============================')
def init_ui(self): BaseDialog.init_ui(self) self.todos = ListBoxTodo() self.todos.set_size_request(300, 500) self.grid.attach(self.todos, 0, 0, 1, 1) expander = Gtk.Expander.new(_('Filter tasks')) expander_grid = Gtk.Grid.new() expander_grid.set_row_spacing(10) expander_grid.set_margin_bottom(10) expander_grid.set_margin_start(10) expander_grid.set_margin_end(10) expander_grid.set_margin_top(10) expander.add(expander_grid) self.grid.attach(expander, 0, 1, 1, 1) label = Gtk.Label.new(_('Priority:')) label.set_halign(Gtk.Align.START) label.set_valign(Gtk.Align.CENTER) label.set_margin_end(10) expander_grid.attach(label, 0, 0, 1, 1) priority_store = Gtk.ListStore(str, int) priority_store.append(['-', -1]) for i in range(0, 26): priority_store.append([chr(i + 65), i]) self.priority = Gtk.ComboBox.new() self.priority.connect('changed', self.on_priority_project_context_changed) self.priority.set_model(priority_store) cell1 = Gtk.CellRendererText() self.priority.pack_start(cell1, True) self.priority.add_attribute(cell1, 'text', 0) expander_grid.attach(self.priority, 1, 0, 1, 1) self.project = None self.context = None self.tags = [] label = Gtk.Label.new(_('Select project:')) label.set_halign(Gtk.Align.START) label.set_valign(Gtk.Align.CENTER) label.set_margin_end(10) expander_grid.attach(label, 0, 1, 1, 1) project_store = Gtk.ListStore(str, str) self.project = Gtk.ComboBox.new() self.project.connect('changed', self.on_priority_project_context_changed) self.project.set_model(project_store) cell1 = Gtk.CellRendererText() self.project.pack_start(cell1, True) self.project.add_attribute(cell1, 'text', 0) expander_grid.attach(self.project, 1, 1, 1, 1) label = Gtk.Label.new(_('Select context:')) label.set_halign(Gtk.Align.START) label.set_valign(Gtk.Align.CENTER) label.set_margin_end(10) expander_grid.attach(label, 0, 2, 1, 1) context_store = Gtk.ListStore(str, str) self.context = Gtk.ComboBox.new() self.context.connect('changed', self.on_priority_project_context_changed) self.context.set_model(context_store) cell1 = Gtk.CellRendererText() self.context.pack_start(cell1, True) self.context.add_attribute(cell1, 'text', 0) expander_grid.attach(self.context, 1, 2, 1, 1) box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 5) self.grid.attach(box, 1, 0, 1, 2) button_add = Gtk.Button.new_with_label(_('Add task')) button_add.connect('clicked', self.on_button_add_clicked) box.add(button_add) button_edit = Gtk.Button.new_with_label(_('Edit task')) button_edit.connect('clicked', self.on_button_edit_clicked) box.add(button_edit) button_remove = Gtk.Button.new_with_label(_('Remove task')) button_remove.connect('clicked', self.on_button_remove_clicked) box.add(button_remove) button_clear = Gtk.Button.new_with_label(_('Clear tasks')) button_clear.connect('clicked', self.on_button_clear_clicked) box.add(button_clear)
def init_ui(self): BaseDialog.init_ui(self) self.headerbar = Gtk.HeaderBar.new() self.headerbar.set_title(self.get_title()) self.headerbar.set_subtitle('-') self.headerbar.set_show_close_button(True) self.set_titlebar(self.headerbar) button0 = Gtk.Button() button0.set_size_request(40, 40) button0.set_tooltip_text(_('One year less')) button0.set_image( Gtk.Image.new_from_icon_name(Gtk.STOCK_GOTO_FIRST, Gtk.IconSize.BUTTON)) button0.connect('clicked', self.on_button0_clicked) self.headerbar.pack_start(button0) button1 = Gtk.Button() button1.set_size_request(40, 40) button1.set_tooltip_text(_('One month less')) button1.set_image( Gtk.Image.new_from_icon_name(Gtk.STOCK_GO_BACK, Gtk.IconSize.BUTTON)) button1.connect('clicked', self.on_button1_clicked) self.headerbar.pack_start(button1) button4 = Gtk.Button() button4.set_size_request(40, 40) button4.set_tooltip_text(_('Today')) image = Gtk.Image() image.set_from_pixbuf( GdkPixbuf.Pixbuf.new_from_file_at_size( os.path.join( comun.IMAGESDIR, '%s-light-normal.svg' % (datetime.datetime.now().day)), 35, 35)) button4.set_image(image) button4.connect('clicked', self.on_button4_clicked) self.headerbar.pack_end(button4) button3 = Gtk.Button() button3.set_size_request(40, 40) button3.set_tooltip_text(_('One year more')) button3.set_image( Gtk.Image.new_from_icon_name(Gtk.STOCK_GOTO_LAST, Gtk.IconSize.BUTTON)) button3.connect('clicked', self.on_button3_clicked) self.headerbar.pack_end(button3) button2 = Gtk.Button() button2.set_size_request(40, 40) button2.set_tooltip_text(_('One month more')) button2.set_image( Gtk.Image.new_from_icon_name(Gtk.STOCK_GO_FORWARD, Gtk.IconSize.BUTTON)) button2.connect('clicked', self.on_button2_clicked) self.headerbar.pack_end(button2) scrolledwindow = Gtk.ScrolledWindow() scrolledwindow.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) scrolledwindow.set_size_request(850, 560) self.grid.attach(scrolledwindow, 1, 1, 1, 1) table1 = Gtk.Grid() table1.set_border_width(2) scrolledwindow.add(table1) self.days = {} self.week_days = {} contador = 0 for row in range(1, 7): label = Gtk.Label.new(str(row)) label.set_width_chars(6) self.week_days[row] = label table1.attach(self.week_days[row], 0, row, 1, 1) for column in range(1, 8): label = Gtk.Label.new(DAY_OF_WEEK[column - 1]) label.set_width_chars(14) label.set_size_request(0, 40) table1.attach(label, column, 0, 1, 1) for row in range(1, 7): for column in range(1, 8): self.days[contador] = MoonDayWidget() table1.attach(self.days[contador], column, row, 1, 1) contador += 1 if self.adate is None: self.adate = datetime.datetime.now() self.set_date()