Esempio n. 1
0
 def __init__(self):
     Clutter.Box.__init__(self)
     self.set_layout_manager(Clutter.BinLayout())
     self.set_color(Clutter.Color.new(0, 0, 0, 96))
     Gst.bind('show-map-coords', self, 'visible')
     MapView.bin_layout_add(self, START, START)
     self.get_layout_manager().add(CoordLabel, CENTER, CENTER)
     MapView.connect('notify::width',
         lambda *ignore: self.set_size(MapView.get_width(), 30))
Esempio n. 2
0
 def __init__(self):
     Clutter.Box.__init__(self)
     self.set_layout_manager(Clutter.BinLayout())
     self.set_color(Clutter.Color.new(0, 0, 0, 96))
     Gst.bind('show-map-coords', self, 'visible')
     MapView.bin_layout_add(self, START, START)
     self.get_layout_manager().add(CoordLabel, CENTER, CENTER)
     MapView.connect('notify::width',
                     lambda *ignore: self.set_size(MapView.get_width(), 30))
Esempio n. 3
0
    def launch(self):
        """Do some things that GtkBuilder XML can't do.

        Ideally this method would not exist. If you see something here that
        can be done directly in the GtkBuilder XML, please let me know.
        """
        self.loaded_photos.set_sort_column_id(3, Gtk.SortType.ASCENDING)

        self.about.set_version(str(REVISION))
        self.about.set_program_name(APPNAME)
        self.about.set_logo(GdkPixbuf.Pixbuf.new_from_file_at_size(
            join(PKG_DATA_DIR, PACKAGE + '.svg'), 192, 192))

        self.main.resize(*Gst.get('window-size'))
        self.main.show_all()

        Gst.bind('left-pane-page', self.photo_camera_gps, 'page')
        Gst.bind('use-dark-theme', Gtk.Settings.get_default(),
                 'gtk-application-prefer-dark-theme')

        placeholder = self.empty_photo_list
        toolbar = self.photo_btn_bar

        def photo_pane_visibility(liststore, *ignore):
            """Hide the placeholder and show the toolbar when appropriate."""
            empty = liststore.get_iter_first() is None
            placeholder.set_visible(empty)
            toolbar.set_visible(not empty)

        self.loaded_photos.connect('row-inserted', photo_pane_visibility)
        self.loaded_photos.connect('row-deleted', photo_pane_visibility)
        self.photos_selection.connect('changed', self.update_highlights)
        self.photos_selection.connect('changed', self.button_sensitivity)
        self.photos_view.connect('button-press-event', self.photoview_pressed)
        self.photos_view.connect('button-release-event', self.photoview_released)
        self.photos_view.connect('row-activated', self.show_large_preview)
        self.large_preview_window.connect('delete_event',
            lambda *ignore: self.large_preview_window.hide_on_delete())

        self.error_bar.connect('response',
            lambda widget, signal: widget.hide())
Esempio n. 4
0
    Gst.set_history(history[-30:])


def go_back(*ignore):
    """Return the map view to where the user last set it."""
    history = list(Gst.get('history'))
    lat, lon, zoom = history.pop()
    if valid_coords(lat, lon):
        MapView.set_zoom_level(zoom)
        MapView.center_on(lat, lon)
    if len(history) > 1:
        Gst.set_history(history)
    else:
        Gst.reset('history')


def zoom_button_sensitivity(view, signal, inn_sensitive, out_sensitive):
    """Ensure zoom buttons are only sensitive when they need to be."""
    zoom = view.get_zoom_level()
    out_sensitive(view.get_min_zoom_level() != zoom)
    inn_sensitive(view.get_max_zoom_level() != zoom)


for prop in ('latitude', 'longitude', 'zoom-level'):
    Gst.bind(prop, MapView, prop)

MapView.connect('notify::zoom-level', zoom_button_sensitivity,
                Widgets.zoom_in_button.set_sensitive,
                Widgets.zoom_out_button.set_sensitive)
MapView.connect('realize', remember_location)
Esempio n. 5
0
 def __init__(self):
     Champlain.Scale.__init__(self)
     self.connect_view(MapView)
     Gst.bind('show-map-scale', self, 'visible')
     MapView.bin_layout_add(self, START, END)
Esempio n. 6
0
 def __init__(self):
     Champlain.Point.__init__(self)
     self.set_size(4)
     self.set_color(Clutter.Color.new(0, 0, 0, 64))
     Gst.bind('show-map-center', self, 'visible')
     MapView.bin_layout_add(self, CENTER, CENTER)
Esempio n. 7
0
 def __init__(self):
     Champlain.Scale.__init__(self)
     self.connect_view(MapView)
     Gst.bind('show-map-scale', self, 'visible')
     MapView.bin_layout_add(self, START, END)
Esempio n. 8
0
 def __init__(self):
     Champlain.Point.__init__(self)
     self.set_size(4)
     self.set_color(Clutter.Color.new(0, 0, 0, 64))
     Gst.bind('show-map-center', self, 'visible')
     MapView.bin_layout_add(self, CENTER, CENTER)
Esempio n. 9
0
def go_back(*ignore):
    """Return the map view to where the user last set it."""
    history = list(Gst.get('history'))
    lat, lon, zoom = history.pop()
    if valid_coords(lat, lon):
        MapView.set_zoom_level(zoom)
        MapView.center_on(lat, lon)
    if len(history) > 1:
        Gst.set_history(history)
    else:
        Gst.reset('history')


def zoom_button_sensitivity(view, signal, inn_sensitive, out_sensitive):
    """Ensure zoom buttons are only sensitive when they need to be."""
    zoom = view.get_zoom_level()
    out_sensitive(view.get_min_zoom_level() != zoom)
    inn_sensitive(view.get_max_zoom_level() != zoom)


for prop in ('latitude', 'longitude', 'zoom-level'):
    Gst.bind(prop, MapView, prop)


MapView.connect(
    'notify::zoom-level',
    zoom_button_sensitivity,
    Widgets.zoom_in_button.set_sensitive,
    Widgets.zoom_out_button.set_sensitive)
MapView.connect('realize', remember_location)