예제 #1
0
 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()
예제 #2
0
 def animate_in(self, start):
     """Animate the crosshair."""
     map_view.bin_layout_add(self.xhair,
         Clutter.BinAlignment.CENTER, Clutter.BinAlignment.CENTER)
     self.xhair.set_z_rotation_from_gravity(45, Clutter.Gravity.CENTER)
     for i in xrange(start, 7, -1):
         self.xhair.set_size(i, i)
         opacity = 0.6407035175879398 * (400 - i) # don't ask
         for actor in [self.xhair, self.label, self.black]:
             actor.set_opacity(opacity)
         while Gtk.events_pending():
             Gtk.main_iteration()
         sleep(0.01)
예제 #3
0
 def animate_in(self, start):
     """Animate the crosshair."""
     map_view.bin_layout_add(self.xhair, Clutter.BinAlignment.CENTER,
                             Clutter.BinAlignment.CENTER)
     self.xhair.set_z_rotation_from_gravity(45, Clutter.Gravity.CENTER)
     for i in xrange(start, 7, -1):
         self.xhair.set_size(i, i)
         opacity = 0.6407035175879398 * (400 - i)  # don't ask
         for actor in [self.xhair, self.label, self.black]:
             actor.set_opacity(opacity)
         while Gtk.events_pending():
             Gtk.main_iteration()
         sleep(0.01)
예제 #4
0
    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)