Esempio n. 1
0
    def __init__(self, viewwin):
        """Initialize the Layers list.
        Takes a single parameter, viewwin,
        which is the view window for which this is a layer list.
        Its only purpose is to access the viewarea because we don't want
        to reference it directly
        """
        gtk.Frame.__init__(self)
        scrlwin = gtk.ScrolledWindow()
        scrlwin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        scrlwin.set_shadow_type(gtk.SHADOW_NONE)
        self.viewwin = viewwin

        #setup connection to view area
        self.viewwin.viewarea.connect('active-changed', self.active_layer_changed)

        self.UImgr = gtk.UIManager()
        self.setup_actions()
        self.make_popup_menu()
        self.updating = True

        icons = ('ly_r','ly_p','ly_l','ly_a','ly_t')
        # layer on icon set
        self.layer_on = [create_pixbuf(icon+'_on') for icon in icons]
        # layer off icon set
        self.layer_off = [create_pixbuf(icon+'_off') for icon in icons]

        #the main layout widget
        shell = gtk.VBox()
        self.add(shell)
        shell.pack_start(scrlwin)

        tree_view = self.make_tree_view()
        scrlwin.add(tree_view)
        tree_view.connect('button-press-event', self.list_clicked)
        tree_view.connect('select-row', self.row_selected)

        # Option buttons
        opts = ((gtk.STOCK_GO_UP, _("Move Up"), self.raise_layer),
                (gtk.STOCK_GO_DOWN, _("Move Down"), self.lower_layer),
                (gtk.STOCK_REMOVE, _("Remove All Layers"), self.remove_all),
                (gtk.STOCK_DELETE, _("Remove Layer"), self.delete_layer))
        self.butbox = gtk.HBox(spacing=1, homogeneous=True)
        shell.pack_start(self.butbox, expand=False)
        for stock,tip,cb in opts:
            but = create_stock_button(stock, cb)
            self.butbox.pack_start(but)
            but.set_tooltip_text(tip)

        self.connect('realize', self.realize)
        self.publish('deleted-layer')

        shell.show_all()
        self.tree_view = tree_view

        self.updating = False
Esempio n. 2
0
 def __init__(self, action=None):
     sym_list = gtk.ListStore(gtk.gdk.Pixbuf, str)
     for sym_name in ogrfs_symbol_names:
         ogr_sym,sym_img = ogrfs_symbols[sym_name]
         pixbuf = create_pixbuf(sym_img)
         sym_list.append( (pixbuf,sym_name) )
     pgu.ComboBox.__init__(self, sym_list, action)
Esempio n. 3
0
 def __init__(self, action=None):
     pen_list = gtk.ListStore(gtk.gdk.Pixbuf, str)
     for pen_name in ogrfs_pen_names:
         ogr_pen,pen_img = ogrfs_pens[pen_name]
         pixbuf = create_pixbuf(pen_img)
         pen_list.append( (pixbuf, pen_name) )
     pgu.ComboBox.__init__(self, pen_list, action)