Esempio n. 1
0
    def __init__(self, shapes, shapesgridtool=None):
        gtk.GtkWindow.__init__(self)
        self.set_title('Schema')
        shell = gtk.GtkVBox(spacing=5)
        shell.set_border_width(10)
        self.add(shell)
        self.grid = pgugrid.pguGrid(config=(2, 0, 0, 1, 4, 0, 0, 0))
        self.grid.subscribe("cell-changed", self.changed_field)
        self.shapes = shapes
        self.shapesgridtool = shapesgridtool
        shell.pack_start(self.grid)

        # New field
        box3 = gtk.GtkTable(rows=5, cols=3)
        box3.set_row_spacings(5)
        box3.set_col_spacings(5)
        box3.set_border_width(10)
        nf_frame = gtk.GtkFrame('Add Field')
        nf_frame.add(box3)
        self.new_field_name_entry = gtk.GtkEntry(10)
        self.new_field_name_entry.set_text('')
        self.new_field_name_entry.set_editable(gtk.TRUE)
        self.new_field_width_entry = gtk.GtkEntry(2)
        self.new_field_width_entry.set_text('20')
        self.new_field_width_entry.set_editable(gtk.TRUE)
        self.new_field_precision_entry = gtk.GtkEntry(2)
        self.new_field_precision_entry.set_text('0')
        self.new_field_precision_entry.set_editable(gtk.FALSE)
        self.new_field_precision_entry.set_sensitive(gtk.FALSE)

        self.new_field_types = ('string', 'integer', 'float')
        self.new_field_type_menu = gvutils.GvOptionMenu(
            self.new_field_types, self.new_field_precision_cb)
        self.new_field_type_menu.set_history(0)
        box3.attach(gtk.GtkLabel('Name'), 0, 1, 0, 1)
        box3.attach(self.new_field_name_entry, 1, 2, 0, 1)
        box3.attach(gtk.GtkLabel('Type'), 0, 1, 1, 2)
        box3.attach(self.new_field_type_menu, 1, 2, 1, 2)
        box3.attach(gtk.GtkLabel('Width'), 0, 1, 2, 3)
        box3.attach(self.new_field_width_entry, 1, 2, 2, 3)
        box3.attach(gtk.GtkLabel('Precision'), 0, 1, 3, 4)
        box3.attach(self.new_field_precision_entry, 1, 2, 3, 4)
        button = gtk.GtkButton("Add")
        box3.attach(button, 0, 2, 4, 5)
        button.connect("clicked", self.add_field)

        shell.pack_start(nf_frame)
        nf_frame.show_all()

        # Ability to delete fields?
        self.fill_grid()
        self.grid.resize_to_default()
        self.show_all()
Esempio n. 2
0
    def __init__(self,shapes,shapesgridtool=None):
        gtk.Window.__init__(self)
        self.set_title('Schema')
        shell=gtk.VBox(spacing=5)
        shell.set_border_width(10)
        self.add(shell)
        self.grid=pgugrid.pguGrid(config=(2,0,0,1,4,0,0,0))
        self.grid.subscribe("cell-changed",self.changed_field)
        self.shapes=shapes
        self.shapesgridtool=shapesgridtool
        shell.pack_start(self.grid)

        # New field
        box3 = gtk.Table(rows=5,cols=3)
        box3.set_row_spacings(5)
        box3.set_col_spacings(5)
        box3.set_border_width(10)
        nf_frame =  gtk.Frame('Add Field')
        nf_frame.add(box3)
        self.new_field_name_entry =  gtk.Entry(10)
        self.new_field_name_entry.set_text('')
        self.new_field_name_entry.set_editable(True) 
        self.new_field_width_entry =  gtk.Entry(2)
        self.new_field_width_entry.set_text('20')
        self.new_field_width_entry.set_editable(True)        
        self.new_field_precision_entry =  gtk.Entry(2)
        self.new_field_precision_entry.set_text('0')
        self.new_field_precision_entry.set_editable(False)
        self.new_field_precision_entry.set_sensitive(False)

        self.new_field_types = ('string','integer','float')
        self.new_field_type_menu = gvutils.GvOptionMenu(self.new_field_types, self.new_field_precision_cb)
        self.new_field_type_menu.set_history(0)
        box3.attach(gtk.Label('Name'),0,1,0,1)
        box3.attach(self.new_field_name_entry,1,2,0,1)
        box3.attach(gtk.Label('Type'),0,1,1,2)
        box3.attach(self.new_field_type_menu,1,2,1,2)
        box3.attach(gtk.Label('Width'),0,1,2,3)
        box3.attach(self.new_field_width_entry,1,2,2,3)
        box3.attach(gtk.Label('Precision'),0,1,3,4)
        box3.attach(self.new_field_precision_entry,1,2,3,4)
        button = gtk.Button("Add")
        box3.attach(button,0,2,4,5)
        button.connect("clicked", self.add_field)

        shell.pack_start(nf_frame)
        nf_frame.show_all()

        # Ability to delete fields?
        self.fill_grid()
        self.grid.resize_to_default()
        self.show_all()
Esempio n. 3
0
 def create_gcp_frame(self):
     self.frames['GCPs']=gtk.Frame('')
     self.frames['GCPs'].set_shadow_type(gtk.SHADOW_NONE)
     vbox=gtk.VBox()
     vbox.set_spacing(spc)
     self.frames['GCPs'].add(vbox)
     self.gcpgrid = pgugrid.pguGrid((3,1,0,1,7,0,0,0,3))
     self.gcpgrid.set_size_request(200,200)
     self.gcplist=[]
     self.gcpgrid.set_source(self.gcplist,
        members=['Id','GCPPixel','GCPLine','GCPX','GCPY','GCPZ'],
        titles = ['ID','Pixel','Line','X','Y','Z'],
        types = ['string','float','float','float','float','float'])
     vbox.pack_start(self.gcpgrid)
     hbox=gtk.HBox()
     hbox.set_spacing(spc)
     vbox.pack_start(hbox)
     self.add_gcp_button=gtk.Button('  Add GCP  ')
     self.add_gcp_button.connect('clicked',self.add_gcp_cb)
     hbox.pack_start(self.add_gcp_button, expand=False)
     self.tips.set_tip(self.add_gcp_button,'Add a new GCP')
     self.load_gcp_button=gtk.Button('Load GCPs')
     self.tips.set_tip(self.load_gcp_button,
        'Clear existing GCPs and load '+
        'new ones from a text file')
     self.load_gcp_button.connect('clicked',self.load_gcps_cb)
     hbox.pack_start(self.load_gcp_button, expand=False)
     self.copy_gcp_button=gtk.Button('Copy GCPs')
     self.copy_gcp_button.connect('clicked',self.copy_gcps_cb)
     self.tips.set_tip(self.copy_gcp_button,
         'Clear existing GCPs and copy new '+
         'ones from another GDAL dataset')
     hbox.pack_start(self.copy_gcp_button, expand=False)
     self.clear_gcp_button=gtk.Button('Clear GCPs')
     self.clear_gcp_button.connect('clicked',self.clear_gcps)
     self.tips.set_tip(self.clear_gcp_button,
         'Clear all GCPs')
     hbox.pack_start(self.clear_gcp_button, expand=False)
     self.gcpprjbox=ProjectionBox(self.tips)
     vbox.pack_start(self.gcpprjbox)
     self.frames['GCPs'].show_all()
     self.pack_start(self.frames['GCPs'])
Esempio n. 4
0
 def create_gcp_frame(self):
     self.frames['GCPs'] = gtk.GtkFrame('')
     self.frames['GCPs'].set_shadow_type(gtk.SHADOW_NONE)
     vbox = gtk.GtkVBox()
     vbox.set_spacing(spc)
     self.frames['GCPs'].add(vbox)
     self.gcpgrid = pgugrid.pguGrid((3, 1, 0, 1, 7, 0, 0, 0, 3))
     self.gcpgrid.set_usize(200, 200)
     self.gcplist = []
     self.gcpgrid.set_source(
         self.gcplist,
         members=['Id', 'GCPPixel', 'GCPLine', 'GCPX', 'GCPY', 'GCPZ'],
         titles=['ID', 'Pixel', 'Line', 'X', 'Y', 'Z'],
         types=['string', 'float', 'float', 'float', 'float', 'float'])
     vbox.pack_start(self.gcpgrid)
     hbox = gtk.GtkHBox()
     hbox.set_spacing(spc)
     vbox.pack_start(hbox)
     self.add_gcp_button = gtk.GtkButton('  Add GCP  ')
     self.add_gcp_button.connect('clicked', self.add_gcp_cb)
     hbox.pack_start(self.add_gcp_button, expand=gtk.FALSE)
     self.tips.set_tip(self.add_gcp_button, 'Add a new GCP')
     self.load_gcp_button = gtk.GtkButton('Load GCPs')
     self.tips.set_tip(
         self.load_gcp_button,
         'Clear existing GCPs and load ' + 'new ones from a text file')
     self.load_gcp_button.connect('clicked', self.load_gcps_cb)
     hbox.pack_start(self.load_gcp_button, expand=gtk.FALSE)
     self.copy_gcp_button = gtk.GtkButton('Copy GCPs')
     self.copy_gcp_button.connect('clicked', self.copy_gcps_cb)
     self.tips.set_tip(
         self.copy_gcp_button, 'Clear existing GCPs and copy new ' +
         'ones from another GDAL dataset')
     hbox.pack_start(self.copy_gcp_button, expand=gtk.FALSE)
     self.clear_gcp_button = gtk.GtkButton('Clear GCPs')
     self.clear_gcp_button.connect('clicked', self.clear_gcps)
     self.tips.set_tip(self.clear_gcp_button, 'Clear all GCPs')
     hbox.pack_start(self.clear_gcp_button, expand=gtk.FALSE)
     self.gcpprjbox = ProjectionBox(self.tips)
     vbox.pack_start(self.gcpprjbox)
     self.frames['GCPs'].show_all()
     self.pack_start(self.frames['GCPs'])
Esempio n. 5
0
    def init_dialog(self):
	self.dialog = gtk.Window()
        self.dialog.set_title('Open Subarea')
        self.dialog.set_border_width(10)   

        mainshell = gtk.VBox(spacing=5)
        self.dialog.add(mainshell)
	mainshell.show()

	self.geocoding = 0
	coord_system_list = ["Pixels", "Geodetic (Lat/Long)", "Georeferenced"]
	self.coord_system = \
	       gvutils.GvOptionMenu(coord_system_list,self.update_gui)
	mainshell.pack_start(self.coord_system)
	self.coord_system.show()

	self.frame_dict = {}
	pix_fields_names = \
	    ('Start Line','Start Pixel','Num of Lines','Num of Pixels')
	self.frame_dict['pixcoord'] = \
	    CoordFrame('Pixel Coordinates', pix_fields_names, True)
	mainshell.pack_start(self.frame_dict['pixcoord'][0], expand=False)

	geo_fields_names = ('Westmost Longitude', 'Eastmost Longitude', \
	    'Northmost Latitude', 'Southmost Latitude')
	self.frame_dict['geodetic'] = \
	    CoordFrame('Geodetic (Lat/Long) Coordinates', \
	    geo_fields_names, False)
	mainshell.pack_start(self.frame_dict['geodetic'][0], expand=False)

	proj_fields_names = ('Northing', 'Westing', 'Southing', 'Easting')
	self.frame_dict['geocoord'] = \
	    CoordFrame('Georeferenced Coordinates', proj_fields_names, False)
	mainshell.pack_start(self.frame_dict['geocoord'][0], expand=False)

	self.band_grid = pgugrid.pguGrid(config=(2,0,1,1,4,0,0,0))
	self.band_grid.subscribe("cell-selection-changed",self.band_selected_cb)
	mainshell.pack_start(self.band_grid,expand=True)

	button_box = gtk.HBox(spacing = 10)
	mainshell.pack_start(button_box, expand=False)
	button_box.show()
	btOK = gtk.Button('OK')
 	button_box.pack_start(btOK)
 	btOK.connect("clicked",self.open_subarea_cb)
 	btOK.show()

	btCancel = gtk.Button('Cancel')
 	button_box.pack_start(btCancel)
	btCancel.connect("clicked", self.close)
	btCancel.show()

        # Trap window close event
        self.dialog.connect('delete-event', self.close)

        for item in self.frame_dict.keys():
            if self.frame_dict[item][2]: 
              self.frame_dict[item][0].show()

        for item in self.frame_dict.keys():
            if self.frame_dict[item][2]: 
              self.frame_dict[item][0].show()
Esempio n. 6
0
    def init_dialog(self):
        self.dialog = gtk.Window()
        self.dialog.set_title('Tabular Shapes Attribute Grid Demo')
        self.dialog.set_default_size(300,400)
        self.dialog.set_resizable(True)

        shell = gtk.VBox(spacing=5)
        shell.set_border_width(10)
        self.dialog.add(shell)

        self.pgugrid=pgugrid.pguGrid(config=(3,2,0,2,4,2,0,0,2))


        shell.pack_start(self.pgugrid,expand=True)

        hbox=gtk.HBox(spacing=5)
        shell.pack_start(hbox)
        self.column_button=gtk.CheckButton("Schema properties only")
        self.column_button.connect("toggled",self.refresh_columns)
        self.column_button.set_active(True)
        hbox.pack_start(self.column_button)

        rbutton = gtk.Button("Refresh columns")
        rbutton.connect("clicked", self.refresh_columns)
        hbox.pack_start(rbutton,expand=False)


        button = gtk.Button("close")
        button.connect("clicked", self.close)
        shell.pack_start(button,expand=False)
        button.show()

        shell.show_all()

        # Trap window close event
        self.dialog.connect('delete-event', self.close)

        self.app.sel_manager.subscribe( 'active-layer-changed',
                                         self.layer_update )

        self.pgugrid.subscribe("clicked",self.clicked_cb)
        self.pgugrid.connect("button-release-event",self.clicked_nocolumns_cb)
        #self.pgugrid.subscribe("cell-selection-changed",self.cell_cb)
        #self.pgugrid.subscribe("cell-changed",self.cellch_cb)
        #self.pgugrid.subscribe("row-selection-changed",self.row_cb)
        #self.pgugrid.subscribe("column-selection-changed",self.column_cb)

        # Popup menus:
        itemlist=[#('Configuration',None,None),
                  ('Set subset/Selected',self.set_subset_selected_cb,None),
                  ('Set subset/Unseleted',self.set_subset_unselected_cb,None),
                  ('Set subset/All',self.set_subset_all_cb,None),
                  ('New layer/Selected',self.new_layer_selected_cb,None),
                  ('New layer/Unselected',self.new_layer_unselected_cb,None),
                  ('Edit Schema',self.edit_schema,None),
                  #('Query',None,None),
                  #('Save',None,None),
                  #('Help',None,None)
                  ]

        self.cell_popup_menu=[]          
        self.cell_popup_menu.append(gtk.Menu())
        for label, func, args in itemlist:
            menu_item = gtk.MenuItem(label)
	    if func is not None:
                menu_item.connect("activate", func, args)
            self.cell_popup_menu[0].append(menu_item)

        self.cell_popup_menu[0].show_all()

        itemlist2=[#('Configuration',None,None),
                  ('Set subset/Selected',self.set_subset_selected_cb,None),
                  ('Set subset/Unseleted',self.set_subset_unselected_cb,None),
                  ('Set subset/All',self.set_subset_all_cb,None),
                  ('New layer/Selected',self.new_layer_selected_cb,None),
                  ('New layer/Unselected',self.new_layer_unselected_cb,None),
                  ('Edit Schema',self.edit_schema,None),
                  ('Add property',self.add_property_column,None),
                  #('Query',None,None),
                  #('Save',None,None),
                  #('Help',None,None)
                  ]

        self.cell_popup_menu.append(gtk.Menu())
        for label, func, args in itemlist2:
            menu_item = gtk.MenuItem(label)
	    if func is not None:
                menu_item.connect("activate", func, args)
            self.cell_popup_menu[1].append(menu_item)

        self.cell_popup_menu[1].show_all()
        # Only do actions when grid is visible
        self.active=0
Esempio n. 7
0
    def init_dialog(self):
        self.dialog = GtkWindow()
        self.dialog.set_title('Open Subarea')
        self.dialog.set_border_width(10)

        mainshell = GtkVBox(spacing=5)
        self.dialog.add(mainshell)
        mainshell.show()

        self.geocoding = 0
        coord_system_list = ["Pixels", "Geodetic (Lat/Long)", "Georeferenced"]
        self.coord_system = \
               gvutils.GvOptionMenu(coord_system_list,self.update_gui)
        mainshell.pack_start(self.coord_system)
        self.coord_system.show()

        self.frame_dict = {}
        pix_fields_names = \
            ('Start Line','Start Pixel','Num of Lines','Num of Pixels')
        self.frame_dict['pixcoord'] = \
            CoordFrame('Pixel Coordinates', pix_fields_names, TRUE)
        mainshell.pack_start(self.frame_dict['pixcoord'][0], expand=FALSE)

        geo_fields_names = ('Westmost Longitude', 'Eastmost Longitude', \
            'Northmost Latitude', 'Southmost Latitude')
        self.frame_dict['geodetic'] = \
            CoordFrame('Geodetic (Lat/Long) Coordinates', \
            geo_fields_names, FALSE)
        mainshell.pack_start(self.frame_dict['geodetic'][0], expand=FALSE)

        proj_fields_names = ('Northing', 'Westing', 'Southing', 'Easting')
        self.frame_dict['geocoord'] = \
            CoordFrame('Georeferenced Coordinates', proj_fields_names, FALSE)
        mainshell.pack_start(self.frame_dict['geocoord'][0], expand=FALSE)

        self.band_grid = pgugrid.pguGrid(config=(2, 0, 1, 1, 4, 0, 0, 0))
        self.band_grid.subscribe("cell-selection-changed",
                                 self.band_selected_cb)
        mainshell.pack_start(self.band_grid, expand=TRUE)

        button_box = GtkHBox(spacing=10)
        mainshell.pack_start(button_box, expand=FALSE)
        button_box.show()
        btOK = GtkButton('OK')
        button_box.pack_start(btOK)
        btOK.connect("clicked", self.open_subarea_cb)
        btOK.show()

        btCancel = GtkButton('Cancel')
        button_box.pack_start(btCancel)
        btCancel.connect("clicked", self.close)
        btCancel.show()

        # Trap window close event
        self.dialog.connect('delete-event', self.close)

        for item in self.frame_dict.keys():
            if self.frame_dict[item][2]:
                self.frame_dict[item][0].show()

        for item in self.frame_dict.keys():
            if self.frame_dict[item][2]:
                self.frame_dict[item][0].show()
Esempio n. 8
0
    def init_dialog(self):
        self.dialog = gtk.GtkWindow()
        self.dialog.set_title('Tabular Shapes Attribute Grid Demo')
        self.dialog.set_default_size(300, 400)
        self.dialog.set_policy(gtk.FALSE, gtk.TRUE, gtk.TRUE)

        shell = gtk.GtkVBox(spacing=5)
        shell.set_border_width(10)
        self.dialog.add(shell)

        self.pgugrid = pgugrid.pguGrid(config=(3, 2, 0, 2, 4, 2, 0, 0, 0))

        shell.pack_start(self.pgugrid, expand=gtk.TRUE)

        hbox = gtk.GtkHBox(spacing=5)
        shell.pack_start(hbox)
        self.column_button = gtk.GtkCheckButton("Schema properties only")
        self.column_button.connect("toggled", self.refresh_columns)
        self.column_button.set_active(gtk.TRUE)
        hbox.pack_start(self.column_button)

        rbutton = gtk.GtkButton("Refresh columns")
        rbutton.connect("clicked", self.refresh_columns)
        hbox.pack_start(rbutton, expand=gtk.FALSE)

        button = gtk.GtkButton("close")
        button.connect("clicked", self.close)
        shell.pack_start(button, expand=gtk.FALSE)
        button.show()

        shell.show_all()

        # Trap window close event
        self.dialog.connect('delete-event', self.close)

        self.app.sel_manager.subscribe('active-layer-changed',
                                       self.layer_update)

        self.pgugrid.subscribe("clicked", self.clicked_cb)
        self.pgugrid.connect("button-release-event", self.clicked_nocolumns_cb)
        #self.pgugrid.subscribe("cell-selection-changed",self.cell_cb)
        #self.pgugrid.subscribe("cell-changed",self.cellch_cb)
        #self.pgugrid.subscribe("row-selection-changed",self.row_cb)
        #self.pgugrid.subscribe("column-selection-changed",self.column_cb)

        # Popup menus:
        itemlist = [  #('Configuration',None,None),
            ('Set subset/Selected', self.set_subset_selected_cb, None),
            ('Set subset/Unseleted', self.set_subset_unselected_cb, None),
            ('Set subset/All', self.set_subset_all_cb, None),
            ('New layer/Selected', self.new_layer_selected_cb, None),
            ('New layer/Unselected', self.new_layer_unselected_cb, None),
            ('Edit Schema', self.edit_schema, None),
            #('Query',None,None),
            #('Save',None,None),
            #('Help',None,None)
        ]

        self.cell_popup_menu = []
        self.cell_popup_menu.append(gtk.GtkMenu())
        for label, func, args in itemlist:
            menu_item = gtk.GtkMenuItem(label)
            if func is not None:
                menu_item.connect("activate", func, args)
            self.cell_popup_menu[0].append(menu_item)

        self.cell_popup_menu[0].show_all()

        itemlist2 = [  #('Configuration',None,None),
            ('Set subset/Selected', self.set_subset_selected_cb, None),
            ('Set subset/Unseleted', self.set_subset_unselected_cb, None),
            ('Set subset/All', self.set_subset_all_cb, None),
            ('New layer/Selected', self.new_layer_selected_cb, None),
            ('New layer/Unselected', self.new_layer_unselected_cb, None),
            ('Edit Schema', self.edit_schema, None),
            ('Add property', self.add_property_column, None),
            #('Query',None,None),
            #('Save',None,None),
            #('Help',None,None)
        ]

        self.cell_popup_menu.append(gtk.GtkMenu())
        for label, func, args in itemlist2:
            menu_item = gtk.GtkMenuItem(label)
            if func is not None:
                menu_item.connect("activate", func, args)
            self.cell_popup_menu[1].append(menu_item)

        self.cell_popup_menu[1].show_all()
        # Only do actions when grid is visible
        self.active = 0