def __init__(self): self.black = Clutter.Box.new(Clutter.BinLayout()) self.black.set_color(Clutter.Color.new(0, 0, 0, 96)) self.label = Clutter.Text() self.label.set_color(Clutter.Color.new(255, 255, 255, 255)) self.xhair = Clutter.Rectangle.new_with_color( Clutter.Color.new(0, 0, 0, 64)) for signal in [ 'latitude', 'longitude' ]: map_view.connect('notify::' + signal, display, get_obj('maps_link'), self.label) map_view.connect('notify::width', lambda view, param, black: black.set_size(view.get_width(), 30), self.black) scale = Champlain.Scale.new() scale.connect_view(map_view) gst.bind('show-map-scale', scale, 'visible') gst.bind('show-map-center', self.xhair, 'visible') gst.bind('show-map-coords', self.black, 'visible') map_view.bin_layout_add(scale, Clutter.BinAlignment.START, Clutter.BinAlignment.END) map_view.bin_layout_add(self.black, Clutter.BinAlignment.START, Clutter.BinAlignment.START) self.black.get_layout_manager().add(self.label, Clutter.BinAlignment.CENTER, Clutter.BinAlignment.CENTER) map_source_menu()
def __init__(self): """Start the map at the previous location, and connect signals.""" perform_zoom = lambda button, zoom: zoom() back_button = get_obj('back_button') zoom_in_button = get_obj('zoom_in_button') zoom_out_button = get_obj('zoom_out_button') zoom_out_button.connect('clicked', perform_zoom, map_view.zoom_out) zoom_in_button.connect('clicked', perform_zoom, map_view.zoom_in) back_button.connect('clicked', go_back, map_view) for key in ['latitude', 'longitude', 'zoom-level']: gst.bind(key, map_view, key) accel = Gtk.AccelGroup() window = get_obj('main') window.add_accel_group(accel) for key in [ 'Left', 'Right', 'Up', 'Down' ]: accel.connect(Gdk.keyval_from_name(key), Gdk.ModifierType.MOD1_MASK, 0, move_by_arrow_keys) map_view.connect('notify::zoom-level', zoom_button_sensitivity, zoom_in_button.set_sensitive, zoom_out_button.set_sensitive) map_view.connect('realize', remember_location) map_view.connect('animation-completed', set_window_title, window.set_title, Coordinates()) map_view.emit('animation-completed')
def __init__(self): """Start the map at the previous location, and connect signals.""" perform_zoom = lambda button, zoom: zoom() back_button = get_obj('back_button') zoom_in_button = get_obj('zoom_in_button') zoom_out_button = get_obj('zoom_out_button') zoom_out_button.connect('clicked', perform_zoom, map_view.zoom_out) zoom_in_button.connect('clicked', perform_zoom, map_view.zoom_in) back_button.connect('clicked', go_back, map_view) for key in ['latitude', 'longitude', 'zoom-level']: gst.bind(key, map_view, key) accel = Gtk.AccelGroup() window = get_obj('main') window.add_accel_group(accel) for key in ['Left', 'Right', 'Up', 'Down']: accel.connect(Gdk.keyval_from_name(key), Gdk.ModifierType.MOD1_MASK, 0, move_by_arrow_keys) map_view.connect('notify::zoom-level', zoom_button_sensitivity, zoom_in_button.set_sensitive, zoom_out_button.set_sensitive) map_view.connect('realize', remember_location) map_view.connect('animation-completed', set_window_title, window.set_title, Coordinates()) map_view.emit('animation-completed')
def __init__(self): self.black = Clutter.Box.new(Clutter.BinLayout()) self.black.set_color(Clutter.Color.new(0, 0, 0, 96)) self.label = Clutter.Text() self.label.set_color(Clutter.Color.new(255, 255, 255, 255)) self.xhair = Clutter.Rectangle.new_with_color( Clutter.Color.new(0, 0, 0, 64)) for signal in ['latitude', 'longitude']: map_view.connect('notify::' + signal, display, get_obj('maps_link'), self.label) map_view.connect( 'notify::width', lambda view, param, black: black.set_size(view.get_width(), 30), self.black) scale = Champlain.Scale.new() scale.connect_view(map_view) map_view.bin_layout_add(scale, Clutter.BinAlignment.START, Clutter.BinAlignment.END) map_view.bin_layout_add(self.black, Clutter.BinAlignment.START, Clutter.BinAlignment.START) self.black.get_layout_manager().add(self.label, Clutter.BinAlignment.CENTER, Clutter.BinAlignment.CENTER)
def __init__(self): self.progressbar = get_obj('progressbar') self.error = Struct({ 'message': get_obj('error_message'), 'icon': get_obj('error_icon'), 'bar': get_obj('error_bar') }) self.error.bar.connect('response', lambda widget, signal: widget.hide()) self.strings = Struct({ 'quit': get_obj('quit').get_property('secondary-text'), 'preview': get_obj('preview_label').get_text() }) self.liststore = get_obj('loaded_photos') self.liststore.set_sort_column_id(TIMESTAMP, Gtk.SortType.ASCENDING) cell_string = Gtk.CellRendererText() cell_thumb = Gtk.CellRendererPixbuf() cell_thumb.set_property('stock-id', Gtk.STOCK_MISSING_IMAGE) cell_thumb.set_property('ypad', 6) cell_thumb.set_property('xpad', 12) column = Gtk.TreeViewColumn('Photos') column.pack_start(cell_thumb, False) column.add_attribute(cell_thumb, 'pixbuf', THUMB) column.pack_start(cell_string, False) column.add_attribute(cell_string, 'markup', SUMMARY) column.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE) get_obj('photos_view').append_column(column) self.drag = DragController(self.open_files) self.navigator = NavigationController() self.search = SearchController() self.prefs = PreferencesController() self.labels = LabelController() self.actors = ActorController() about = get_obj('about') about.set_version(REVISION) about.set_program_name(APPNAME) about.set_logo( GdkPixbuf.Pixbuf.new_from_file_at_size( join(PKG_DATA_DIR, PACKAGE + '.svg'), 192, 192)) click_handlers = { 'open_button': [self.add_files_dialog, get_obj('open')], 'save_button': [self.save_all_files], 'clear_button': [clear_all_gpx], 'close_button': [self.close_selected_photos], 'revert_button': [self.revert_selected_photos], 'about_button': [lambda b, d: d.run() and d.hide(), about], 'apply_button': [self.apply_selected_photos, map_view], 'select_all_button': [toggle_selected_photos, self.labels.selection] } for button, handler in click_handlers.items(): get_obj(button).connect('clicked', *handler) accel = Gtk.AccelGroup() window = get_obj('main') window.resize(*gst.get('window-size')) window.connect('delete_event', self.confirm_quit_dialog) window.add_accel_group(accel) window.show_all() # Hide the unused button that appears beside the map source menu. get_obj('map_source_menu_button').get_child().get_children( )[0].set_visible(False) save_size = lambda v, s, size: gst.set_window_size(size()) for prop in ['width', 'height']: map_view.connect('notify::' + prop, save_size, window.get_size) accel.connect(Gdk.keyval_from_name('q'), Gdk.ModifierType.CONTROL_MASK, 0, self.confirm_quit_dialog) self.labels.selection.emit('changed') clear_all_gpx() metadata.delta = 0 self.secbutton, self.minbutton = get_obj('seconds'), get_obj('minutes') for spinbutton in [self.secbutton, self.minbutton]: spinbutton.connect('value-changed', self.time_offset_changed) gst.bind('offset-minutes', self.minbutton, 'value') gst.bind('offset-seconds', self.secbutton, 'value') gst.bind('left-pane-page', get_obj('photo_camera_gps'), 'page') get_obj('open').connect('update-preview', self.update_preview, get_obj('preview_label'), get_obj('preview_image'))
def __init__(self): self.progressbar = get_obj('progressbar') self.error = Struct({ 'message': get_obj('error_message'), 'icon': get_obj('error_icon'), 'bar': get_obj('error_bar') }) self.error.bar.connect('response', lambda widget, signal: widget.hide()) self.strings = Struct({ 'quit': get_obj('quit').get_property('secondary-text'), 'preview': get_obj('preview_label').get_text() }) self.liststore = get_obj('loaded_photos') self.liststore.set_sort_column_id(TIMESTAMP, Gtk.SortType.ASCENDING) cell_string = Gtk.CellRendererText() cell_thumb = Gtk.CellRendererPixbuf() cell_thumb.set_property('stock-id', Gtk.STOCK_MISSING_IMAGE) cell_thumb.set_property('ypad', 6) cell_thumb.set_property('xpad', 12) column = Gtk.TreeViewColumn('Photos') column.pack_start(cell_thumb, False) column.add_attribute(cell_thumb, 'pixbuf', THUMB) column.pack_start(cell_string, False) column.add_attribute(cell_string, 'markup', SUMMARY) column.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE) get_obj('photos_view').append_column(column) self.drag = DragController(self.open_files) self.navigator = NavigationController() self.search = SearchController() self.prefs = PreferencesController() self.labels = LabelController() self.actors = ActorController() about = get_obj('about') about.set_version(REVISION) about.set_program_name(APPNAME) about.set_logo(GdkPixbuf.Pixbuf.new_from_file_at_size( join(PKG_DATA_DIR, PACKAGE + '.svg'), 192, 192)) click_handlers = { 'open_button': [self.add_files_dialog, get_obj('open')], 'save_button': [self.save_all_files], 'clear_button': [clear_all_gpx], 'close_button': [self.close_selected_photos], 'revert_button': [self.revert_selected_photos], 'about_button': [lambda b, d: d.run() and d.hide(), about], 'apply_button': [self.apply_selected_photos, map_view], 'select_all_button': [toggle_selected_photos, self.labels.selection] } for button, handler in click_handlers.items(): get_obj(button).connect('clicked', *handler) accel = Gtk.AccelGroup() window = get_obj('main') window.resize(*gst.get('window-size')) window.connect('delete_event', self.confirm_quit_dialog) window.add_accel_group(accel) window.show_all() # Hide the unused button that appears beside the map source menu. get_obj('map_source_menu_button').get_child().get_children()[0].set_visible(False) save_size = lambda v, s, size: gst.set_window_size(size()) for prop in ['width', 'height']: map_view.connect('notify::' + prop, save_size, window.get_size) accel.connect(Gdk.keyval_from_name('q'), Gdk.ModifierType.CONTROL_MASK, 0, self.confirm_quit_dialog) self.labels.selection.emit('changed') clear_all_gpx() metadata.delta = 0 self.secbutton, self.minbutton = get_obj('seconds'), get_obj('minutes') for spinbutton in [ self.secbutton, self.minbutton ]: spinbutton.connect('value-changed', self.time_offset_changed) gst.bind('offset-minutes', self.minbutton, 'value') gst.bind('offset-seconds', self.secbutton, 'value') gst.bind('left-pane-page', get_obj('photo_camera_gps'), 'page') get_obj('open').connect('update-preview', self.update_preview, get_obj('preview_label'), get_obj('preview_image'))
def __init__(self): self.message_timeout_source = None self.progressbar = get_obj('progressbar') self.error = Struct({ 'message': get_obj('error_message'), 'icon': get_obj('error_icon'), 'bar': get_obj('error_bar') }) self.error.bar.connect('response', lambda widget, signal: widget.hide()) self.strings = Struct({ 'quit': get_obj('quit').get_property('secondary-text'), 'preview': get_obj('preview_label').get_text() }) self.liststore = get_obj('loaded_photos') self.liststore.set_sort_column_id(TIMESTAMP, Gtk.SortType.ASCENDING) cell_string = Gtk.CellRendererText() cell_string.set_property('wrap-mode', Pango.WrapMode.WORD) cell_string.set_property('wrap-width', 200) cell_thumb = Gtk.CellRendererPixbuf() cell_thumb.set_property('stock-id', Gtk.STOCK_MISSING_IMAGE) cell_thumb.set_property('ypad', 6) cell_thumb.set_property('xpad', 12) column = Gtk.TreeViewColumn('Photos') column.pack_start(cell_thumb, False) column.add_attribute(cell_thumb, 'pixbuf', THUMB) column.pack_start(cell_string, False) column.add_attribute(cell_string, 'markup', SUMMARY) column.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE) # Deal with multiple selection drag and drop. self.defer_select = False photos_view = get_obj('photos_view') photos_view.connect('button-press-event', self.photoview_pressed) photos_view.connect('button-release-event', self.photoview_released) photos_view.append_column(column) self.drag = DragController(self.open_files) self.navigator = NavigationController() self.search = SearchController() self.labels = LabelController() self.actors = ActorController() about = get_obj('about') about.set_version(REVISION) about.set_program_name(APPNAME) about.set_logo(GdkPixbuf.Pixbuf.new_from_file_at_size( join(PKG_DATA_DIR, PACKAGE + '.svg'), 192, 192)) click_handlers = { 'open_button': [self.add_files_dialog, get_obj('open')], 'save_button': [self.save_all_files], 'close_button': [lambda btn: [p.destroy() for p in selected.copy()]], 'revert_button': [lambda btn: self.open_files( [p.filename for p in modified & selected])], 'about_button': [lambda yes, you_can: you_can.run() and you_can.hide(), about], 'help_button': [lambda *ignore: Gtk.show_uri(Gdk.Screen.get_default(), 'ghelp:gottengeography', Gdk.CURRENT_TIME)], 'jump_button': [self.jump_to_photo], 'apply_button': [self.apply_selected_photos], } for button, handler in click_handlers.items(): get_obj(button).connect('clicked', *handler) # Hide the unused button that appears beside the map source menu. ugly = get_obj('map_source_menu_button').get_child().get_children()[0] ugly.set_no_show_all(True) ugly.hide() accel = Gtk.AccelGroup() window = get_obj('main') window.resize(*gst.get('window-size')) window.connect('delete_event', self.confirm_quit_dialog) window.add_accel_group(accel) window.show_all() save_size = lambda v, s, size: gst.set_window_size(size()) for prop in ['width', 'height']: map_view.connect('notify::' + prop, save_size, window.get_size) accel.connect(Gdk.keyval_from_name('q'), Gdk.ModifierType.CONTROL_MASK, 0, self.confirm_quit_dialog) self.labels.selection.emit('changed') clear_all_gpx() button = get_obj('apply_button') gst.bind('left-pane-page', get_obj('photo_camera_gps'), 'page') gst.bind('use-dark-theme', Gtk.Settings.get_default(), 'gtk-application-prefer-dark-theme') # This bit of magic will only show the apply button when there is # at least one photo loaded that is not manually positioned. # In effect, it allows you to manually drag & drop some photos, # then batch-apply all the rest btn_sense = lambda *x: button.set_sensitive( [photo for photo in photos.values() if not photo.manual]) self.liststore.connect('row-changed', btn_sense) self.liststore.connect('row-deleted', btn_sense) empty = get_obj('empty_photo_list') empty_visible = lambda l, *x: empty.set_visible(l.get_iter_first() is None) self.liststore.connect('row-changed', empty_visible) self.liststore.connect('row-deleted', empty_visible) toolbar = get_obj('photo_btn_bar') bar_visible = lambda l, *x: toolbar.set_visible(l.get_iter_first() is not None) self.liststore.connect('row-changed', bar_visible) self.liststore.connect('row-deleted', bar_visible) get_obj('open').connect('update-preview', self.update_preview, get_obj('preview_label'), get_obj('preview_image'))