示例#1
0
文件: pgumenu.py 项目: lmarabi/tareeg
 def __init__(self, label=""):
     import pgutogglebutton
     gtk.GtkMenuItem.__init__( self )
         
     hbox = gtk.GtkHBox( spacing = 2 )
     self.tb = pgutogglebutton.pguToggleButton( )
     self.tb.connect( 'toggled', self.toggled_cb)
     hbox.pack_start( self.tb, expand=FALSE )
     
     evt_box = gtk.GtkEventBox()
     evt_box.connect( 'button-release-event', self.toggle_it )
     
     lbl = gtk.GtkLabel( label )
     evt_box.add( lbl )
     
     hbox.pack_start( evt_box )
     self.add( hbox )
     self.show_all()
示例#2
0
    def __init__(self, layer):
        GtkWindow.__init__(self)
        self.set_title(layer.get_name() + ' Properties')
        self.layer = layer
        self.updating = FALSE

        if self.layer is not None:
            self.display_change_id = layer.connect('display-change',
                                                   self.refresh_cb)
            self.teardown_id = layer.connect('teardown', self.close)

        # create the general layer properties dialog
        self.create_notebook()
        self.create_pane1()

        # Setup Object Drawing Properties Tab
        self.pane2 = GtkVBox(spacing=10)
        self.pane2.set_border_width(10)
        self.notebook.append_page(self.pane2, GtkLabel('Draw Styles'))

        gvhtml.set_help_topic(self, "gvvectorpropdlg.html")

        # ANTIALIASING
        box = GtkHBox(spacing=3)
        self.pane2.pack_start(box)
        box.pack_start(GtkLabel("Anti-alias:"), expand=FALSE)
        self.antialias = pgutogglebutton.pguToggleButton()
        self.antialias.connect('toggled', self.antialias_cb)
        box.pack_start(self.antialias, expand=FALSE)

        # POINT CONTROLS -----------------------------------------------------
        frame = GtkFrame('Points')
        self.pane2.pack_start(frame)

        vbox = GtkVBox(spacing=10)
        vbox.set_border_width(10)
        frame.add(vbox)

        #create a symbol control
        box = GtkHBox(spacing=3)
        vbox.pack_start(box, expand=FALSE)
        box.pack_start(GtkLabel('Symbol:'), expand=FALSE)
        self.point_symbol = GtkCombo()
        #add a default to symbol names
        self.point_symbol.set_popdown_strings(tuple(symbols))
        self.point_symbol.entry.set_editable(FALSE)
        #self.point_symbol.set_value_in_list(TRUE, FALSE)
        self.point_symbol.entry.connect('changed', self.symbol_cb)
        box.pack_start(self.point_symbol)

        # Create Color control.
        box = GtkHBox(spacing=3)
        vbox.pack_start(box, expand=FALSE)
        box.pack_start(GtkLabel('Color:'), expand=FALSE)
        self.point_color = pgucolorsel.ColorControl('Point Color',
                                                    self.symbol_cb)
        box.pack_start(self.point_color)

        # Point size
        box = GtkHBox(spacing=3)
        vbox.pack_start(box, expand=FALSE)
        box.pack_start(GtkLabel('Point Size:'), expand=FALSE)
        self.point_size = GtkCombo()
        self.point_size.set_popdown_strings(
            ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '15', '20'))
        self.point_size.entry.connect('changed', self.point_size_cb)
        box.pack_start(self.point_size, expand=FALSE)

        # LINE CONTROLS ------------------------------------------------------
        frame = GtkFrame('Lines')
        self.pane2.pack_start(frame)

        vbox = GtkVBox()
        vbox.set_border_width(10)
        frame.add(vbox)

        # Create Color control.
        box = GtkHBox(spacing=3)
        vbox.pack_start(box, expand=FALSE)
        box.pack_start(GtkLabel('Color:'), expand=FALSE)
        self.line_color = pgucolorsel.ColorControl('Line Color', self.color_cb,
                                                   '_line_color')
        box.pack_start(self.line_color)

        #Line Width
        box = GtkHBox(spacing=3)
        vbox.pack_start(box, expand=FALSE)
        box.pack_start(GtkLabel('Width:'), expand=FALSE)
        self.line_width = GtkEntry()
        self.line_width.connect('changed', self.line_width_cb)
        box.pack_start(self.line_width, expand=FALSE)

        # AREA CONTROLS ------------------------------------------------------
        frame = GtkFrame('Areas')
        self.pane2.pack_start(frame)

        vbox = GtkVBox(spacing=10)
        vbox.set_border_width(10)
        frame.add(vbox)

        # Create Color controls
        box = GtkHBox(spacing=3)
        vbox.pack_start(box, expand=FALSE)
        box.pack_start(GtkLabel('Edge Color:'), expand=FALSE)
        self.area_edge_color = pgucolorsel.ColorControl(
            'Area Edge Color', self.color_cb, '_area_edge_color')
        box.pack_start(self.area_edge_color)

        box = GtkHBox(spacing=3)
        vbox.pack_start(box, expand=FALSE)
        box.pack_start(GtkLabel('Fill Color:'), expand=FALSE)
        self.area_fill_color = pgucolorsel.ColorControl(
            'Area Fill Color', self.color_cb, '_area_fill_color')
        box.pack_start(self.area_fill_color)

        #Area Edge Width
        box = GtkHBox(spacing=3)
        vbox.pack_start(box, expand=FALSE)
        box.pack_start(GtkLabel('Edge Width:'), expand=FALSE)
        self.area_edge_width = GtkEntry()
        self.area_edge_width.connect('changed', self.area_edge_width_cb)
        box.pack_start(self.area_edge_width, expand=FALSE)

        # LABEL CONTROLS -----------------------------------------------------
        frame = GtkFrame('Labels')
        self.pane2.pack_start(frame)

        vbox = GtkVBox(spacing=10)
        vbox.set_border_width(10)
        frame.add(vbox)

        # collect candidate field names from the schema.
        fnlist = ['disabled']
        schema = self.layer.get_parent().get_schema()
        for item in schema:
            fnlist.append(item[0])

        # Field Name
        box = GtkHBox(spacing=3)
        vbox.pack_start(box, expand=FALSE)
        box.pack_start(GtkLabel('Label Field:'), expand=FALSE)
        self.label_field = GtkCombo()
        self.label_field.set_popdown_strings(fnlist)
        self.label_field.entry.connect('changed', self.label_change_cb)
        box.pack_start(self.label_field, expand=FALSE)

        # Create Color control.
        box = GtkHBox(spacing=3)
        vbox.pack_start(box, expand=FALSE)
        box.pack_start(GtkLabel('Color:'), expand=FALSE)
        self.label_color = pgucolorsel.ColorControl('Label Color',
                                                    self.label_change_cb)
        box.pack_start(self.label_color)

        # Font
        font_list = self.layer.get_view().get_fontnames()
        box = GtkHBox(spacing=3)
        vbox.pack_start(box, expand=FALSE)
        box.pack_start(GtkLabel('Font:'), expand=FALSE)
        self.label_font = GtkCombo()
        self.label_font.set_popdown_strings(font_list)
        self.label_font.entry.connect('changed', self.label_change_cb)
        box.pack_start(self.label_font, expand=FALSE)

        self.update_gui()

        self.show_all()
示例#3
0
    def __init__(self, layer):
        GtkWindow.__init__(self)
        self.set_title(layer.get_name()+' Properties')
        self.layer = layer
        self.updating = FALSE

        if self.layer is not None:
            self.display_change_id = layer.connect('display-change',
                                                   self.refresh_cb)
            self.teardown_id = layer.connect('teardown',self.close)

        # create the general layer properties dialog
        self.create_notebook()
        self.create_pane1()

        # Setup Object Drawing Properties Tab
        self.pane2 = GtkVBox(spacing=10)
        self.pane2.set_border_width(10)
        self.notebook.append_page( self.pane2, GtkLabel('Draw Styles'))

        gvhtml.set_help_topic( self, "gvvectorpropdlg.html" )


        # ANTIALIASING
        box = GtkHBox(spacing=3)
        self.pane2.pack_start(box)
        box.pack_start( GtkLabel("Anti-alias:"), expand=FALSE )
        self.antialias = pgutogglebutton.pguToggleButton()
        self.antialias.connect('toggled', self.antialias_cb )
        box.pack_start( self.antialias, expand=FALSE )

        # POINT CONTROLS -----------------------------------------------------
        frame = GtkFrame('Points')
        self.pane2.pack_start(frame)

        vbox = GtkVBox(spacing=10)
        vbox.set_border_width(10)
        frame.add(vbox)

        #create a symbol control
        box = GtkHBox(spacing=3)
        vbox.pack_start(box, expand=FALSE)
        box.pack_start(GtkLabel('Symbol:'), expand=FALSE)
        self.point_symbol = GtkCombo()
        #add a default to symbol names
        self.point_symbol.set_popdown_strings( tuple(symbols) )
        self.point_symbol.entry.set_editable(FALSE)
        #self.point_symbol.set_value_in_list(TRUE, FALSE)
        self.point_symbol.entry.connect('changed', self.symbol_cb)
        box.pack_start(self.point_symbol)

        # Create Color control.
        box = GtkHBox(spacing=3)
        vbox.pack_start(box, expand=FALSE)
        box.pack_start(GtkLabel('Color:'),expand=FALSE)
        self.point_color = pgucolorsel.ColorControl('Point Color',
                                                  self.symbol_cb)
        box.pack_start(self.point_color)

        # Point size
        box = GtkHBox(spacing=3)
        vbox.pack_start(box, expand=FALSE)
        box.pack_start(GtkLabel('Point Size:'),expand=FALSE)
        self.point_size = GtkCombo()
        self.point_size.set_popdown_strings(
            ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '15', '20') )
        self.point_size.entry.connect('changed', self.point_size_cb)
        box.pack_start(self.point_size,expand=FALSE)

        # LINE CONTROLS ------------------------------------------------------
        frame = GtkFrame('Lines')
        self.pane2.pack_start(frame)

        vbox = GtkVBox()
        vbox.set_border_width(10)
        frame.add(vbox)

        # Create Color control.
        box = GtkHBox(spacing=3)
        vbox.pack_start(box, expand=FALSE)
        box.pack_start(GtkLabel('Color:'),expand=FALSE)
        self.line_color = pgucolorsel.ColorControl('Line Color',
                                         self.color_cb,'_line_color')
        box.pack_start(self.line_color)
        
        #Line Width
        box = GtkHBox(spacing=3)
        vbox.pack_start(box, expand=FALSE)
        box.pack_start(GtkLabel('Width:'), expand=FALSE)
        self.line_width = GtkEntry()
        self.line_width.connect('changed', self.line_width_cb)
        box.pack_start( self.line_width, expand=FALSE)
        

        # AREA CONTROLS ------------------------------------------------------
        frame = GtkFrame('Areas')
        self.pane2.pack_start(frame)

        vbox = GtkVBox(spacing=10)
        vbox.set_border_width(10)
        frame.add(vbox)

        # Create Color controls
        box = GtkHBox(spacing=3)
        vbox.pack_start(box, expand=FALSE)
        box.pack_start(GtkLabel('Edge Color:'),expand=FALSE)
        self.area_edge_color = pgucolorsel.ColorControl('Area Edge Color',
                                              self.color_cb,'_area_edge_color')
        box.pack_start(self.area_edge_color)

        box = GtkHBox(spacing=3)
        vbox.pack_start(box, expand=FALSE)
        box.pack_start(GtkLabel('Fill Color:'),expand=FALSE)
        self.area_fill_color = pgucolorsel.ColorControl('Area Fill Color',
                                              self.color_cb,'_area_fill_color')
        box.pack_start(self.area_fill_color)

        #Area Edge Width
        box = GtkHBox(spacing=3)
        vbox.pack_start(box, expand=FALSE)
        box.pack_start(GtkLabel('Edge Width:'), expand=FALSE)
        self.area_edge_width = GtkEntry()
        self.area_edge_width.connect('changed', self.area_edge_width_cb)
        box.pack_start( self.area_edge_width, expand=FALSE)
        

        # LABEL CONTROLS -----------------------------------------------------
        frame = GtkFrame('Labels')
        self.pane2.pack_start(frame)

        vbox = GtkVBox(spacing=10)
        vbox.set_border_width(10)
        frame.add(vbox)

        # collect candidate field names from the schema.
        fnlist = [ 'disabled' ]
        schema = self.layer.get_parent().get_schema()
        for item in schema:
            fnlist.append( item[0] )

        # Field Name
        box = GtkHBox(spacing=3)
        vbox.pack_start(box, expand=FALSE)
        box.pack_start(GtkLabel('Label Field:'),expand=FALSE)
        self.label_field = GtkCombo()
        self.label_field.set_popdown_strings( fnlist )
        self.label_field.entry.connect('changed', self.label_change_cb)
        box.pack_start(self.label_field,expand=FALSE)

        # Create Color control.
        box = GtkHBox(spacing=3)
        vbox.pack_start(box, expand=FALSE)
        box.pack_start(GtkLabel('Color:'),expand=FALSE)
        self.label_color = pgucolorsel.ColorControl('Label Color',
                                                    self.label_change_cb)
        box.pack_start(self.label_color)

        # Font
        font_list = self.layer.get_view().get_fontnames()
        box = GtkHBox(spacing=3)
        vbox.pack_start(box, expand=FALSE)
        box.pack_start(GtkLabel('Font:'),expand=FALSE)
        self.label_font = GtkCombo()
        self.label_font.set_popdown_strings(font_list)
        self.label_font.entry.connect('changed', self.label_change_cb)
        box.pack_start(self.label_font,expand=FALSE)

        self.update_gui()

        self.show_all()