jschuengel: thuban/Extensions/umn_mapserver mf_handle.py,1.2,1.3

cvs@intevation.de cvs at intevation.de
Wed Jul 7 14:52:18 CEST 2004


Author: jschuengel

Update of /thubanrepository/thuban/Extensions/umn_mapserver
In directory doto:/tmp/cvs-serv26469

Modified Files:
	mf_handle.py 
Log Message:
Added some setting to the Label Dialog and add the OutputDialog.
Make some changes to the code order.


Index: mf_handle.py
===================================================================
RCS file: /thubanrepository/thuban/Extensions/umn_mapserver/mf_handle.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- mf_handle.py	6 Jul 2004 14:30:45 -0000	1.2
+++ mf_handle.py	7 Jul 2004 12:52:16 -0000	1.3
@@ -52,7 +52,7 @@
 
 from mapfile import unit_type, legend_status_type, legend_position_type, \
                     label_font_type, scalebar_status_type, scalebar_style_type, \
-                    scalebar_position_type
+                    scalebar_position_type, label_position_type, image_type
 
 # ###################################
 #
@@ -84,11 +84,7 @@
                      wxALL|wxALIGN_CENTER_VERTICAL, 4)  
 
         #create size settings
-        try:
-            insidetxt = self.tb_map_umn.get_size()
-        except:
-            insidetxt = (0,0)
-        # create the Size Box
+        insidetxt = self.tb_map_umn.get_size()
         staticSize = wxStaticBox(self, 1010, _("Size"), style = 0, name = "staticBox",   )
         box_size = wxStaticBoxSizer(staticSize, wxVERTICAL)
         
@@ -132,6 +128,14 @@
         EVT_BUTTON(self, ID_COLOR_CHANGE, self.OnChangeColor)
         box_color.Add(button, 1, wxEXPAND|wxALL, 5)
         
+        # status
+        umn_status = self.tb_map_umn.get_status()
+        self.choice_status = wxRadioBox(self, -1, choices=["True","False"],
+              label='status', majorDimension=1,
+              name='status check', size=wxDefaultSize, style=wxRA_SPECIFY_ROWS)
+        self.choice_status.SetStringSelection(str(umn_status))
+        
+        
         #buttons
         box_buttons = wxBoxSizer(wxHORIZONTAL)
         button = wxButton(self, wxID_OK, _("OK"))
@@ -147,7 +151,8 @@
         top.Add(box_name, 0, wxEXPAND |wxALL, 5)
         top.Add(box_size, 0, wxEXPAND |wxALL, 5)
         top.Add(box_units,0, wxEXPAND |wxALL, 5)
-        top.Add(box_color,0, wxEXPAND |wxALL, 5)       
+        top.Add(box_color,0, wxEXPAND |wxALL, 5)     
+        top.Add(self.choice_status,0, wxEXPAND |wxALL, 5)   
         top.Add(box_buttons, 0, wxALIGN_RIGHT)
         
         # final layout settings
@@ -182,8 +187,13 @@
         self.Show(False)
 
     def OnOK(self, event):
-        self.tb_map_umn.set_size(int(self.text_width.GetValue()), int(self.text_height.GetValue()))
+        self.tb_map_umn.set_size(int(self.text_width.GetValue()), 
+                                 int(self.text_height.GetValue()))
         self.tb_map_umn.set_units(self.choice_units.GetStringSelection())
+        if self.choice_status.GetStringSelection() == "True":
+            self.tb_map_umn.set_status(True)
+        else:
+            self.tb_map_umn.set_status(False)
         previewcolor = self.previewcolor.GetBackgroundColour()
         self.tb_map_umn.get_imagecolor().set_rgbcolor(previewcolor.Red(),
                     previewcolor.Green(), previewcolor.Blue())
@@ -194,8 +204,8 @@
         self.end_dialog(None)
 
 
-class Web_Dialog(wxDialog):
-        
+class OutputFormat_Dialog(wxDialog):
+    
     def __init__(self, parent, ID, title,
                  pos=wxDefaultPosition, size=wxDefaultSize,
                  style=wxDEFAULT_DIALOG_STYLE):
@@ -203,8 +213,73 @@
         # initialize the Dialog
         wxDialog.__init__(self, parent, ID, title, pos, size, style)
 
-         #add all boxes to this top box
+        #  get the web object
+        self.tb_map = parent.canvas.Map()
+        self.tb_map_umn = self.tb_map.extension_umn_mapobj
+        
+        #get the outputformat
+        umn_imagetype = self.tb_map_umn.get_imagetype()
+        #Imagetype selector
+        box_imagetypeStatic = wxStaticBox(self, -1, _("Image Type"),  style = 0, name = "imagetype")
+        box_imagetype = wxStaticBoxSizer(box_imagetypeStatic, wxVERTICAL)
+        self.choice_imgtype = wxChoice(self, 8060, (80, 50), choices = image_type)
+        EVT_CHOICE(self, 8060, self.EvtChoiceBox)
+        self.choice_imgtype.SetStringSelection(umn_imagetype)
+        box_imagetype.Add(self.choice_imgtype,0, wxEXPAND, wxALL, 5)    
+      
+        #buttons
+        box_buttons = wxBoxSizer(wxHORIZONTAL)
+        button = wxButton(self, wxID_OK, _("OK"))
+        box_buttons.Add(button, 0, wxALL, 5)
+        button = wxButton(self, wxID_CANCEL, _("Cancel"))
+        box_buttons.Add(button, 0, wxALL, 5)
+        #set the button funcitons
+        EVT_BUTTON(self, wxID_OK, self.OnOK)
+        EVT_BUTTON(self, wxID_CANCEL, self.OnCancel)
+        
+        #add all boxes to the box top
         top = wxBoxSizer(wxVERTICAL)
+        top.Add(box_imagetype,0, wxEXPAND |wxALL, 5)
+        top.Add(box_buttons, 0, wxALIGN_RIGHT)
+        # final layout settings
+        self.SetSizer(top)
+        top.Fit(self)
+    
+    def EvtChoiceBox(self, event):
+        print self.choice_imgtype.GetStringSelection()
+        outformat = self.tb_map_umn.get_outputformat().get_name()
+        print outformat
+
+        
+    def RunDialog(self):
+        self.ShowModal()
+        self.Destroy()
+
+    def end_dialog(self, result):
+        self.result = result
+        if self.result is not None:
+            self.EndModal(wxID_OK)
+        else:
+            self.EndModal(wxID_CANCEL)
+        self.Show(False)
+
+    def OnOK(self, event):
+        self.tb_map_umn.set_imagetype(self.choice_imgtype.GetStringSelection())
+        self.result ="OK"
+        self.end_dialog(self.result)
+
+    def OnCancel(self, event):
+        self.end_dialog(None)
+
+
+class Web_Dialog(wxDialog):
+        
+    def __init__(self, parent, ID, title,
+                 pos=wxDefaultPosition, size=wxDefaultSize,
+                 style=wxDEFAULT_DIALOG_STYLE):
+                     
+        # initialize the Dialog
+        wxDialog.__init__(self, parent, ID, title, pos, size, style)
 
         #  get the web object
         self.tb_map = parent.canvas.Map()
@@ -216,7 +291,6 @@
                      wxALL|wxALIGN_CENTER_VERTICAL, 4)
         box_name.Add(wxStaticText(self, -1, self.tb_map.Title()), 0,
                      wxALL|wxALIGN_CENTER_VERTICAL, 4) 
-        top.Add(box_name, 0, wxEXPAND |wxALL, 5)
         
         # Imagepath 
         box_imagepath = wxBoxSizer(wxHORIZONTAL)
@@ -225,7 +299,6 @@
         self.text_imagepath = wxTextCtrl(self, -1, str(self.umn_web.get_imagepath()))
         box_imagepath.Add(self.text_imagepath, 0,
                      wxALL|wxALIGN_CENTER_VERTICAL, 4)  
-        top.Add(box_imagepath, 0, wxEXPAND |wxALL, 5)
 
         # Imageurl 
         box_imageurl = wxBoxSizer(wxHORIZONTAL)
@@ -234,7 +307,6 @@
         self.text_imageurl = wxTextCtrl(self, -1, str(self.umn_web.get_imageurl()))
         box_imageurl.Add(self.text_imageurl, 0,
                      wxALL|wxALIGN_CENTER_VERTICAL, 4)  
-        top.Add(box_imageurl, 0, wxEXPAND |wxALL, 5)
 
         # queryformat 
         # include from a query dialog later
@@ -255,7 +327,13 @@
         box_buttons.Add(button, 0, wxALL, 5)
         #set the button funcitons
         EVT_BUTTON(self, wxID_OK, self.OnOK)
-        EVT_BUTTON(self, wxID_CANCEL, self.OnCancel)        
+        EVT_BUTTON(self, wxID_CANCEL, self.OnCancel)      
+      
+        # compose the final dialog
+        top = wxBoxSizer(wxVERTICAL)
+        top.Add(box_name, 0, wxEXPAND |wxALL, 5)
+        top.Add(box_imagepath, 0, wxEXPAND |wxALL, 5)
+        top.Add(box_imageurl, 0, wxEXPAND |wxALL, 5)
         top.Add(box_buttons, 0, wxALIGN_RIGHT)
         
         # final layout settings
@@ -277,7 +355,7 @@
     def OnOK(self, event):
         self.umn_web.set_imagepath(self.text_imagepath.GetValue())
         self.umn_web.set_imageurl(self.text_imageurl.GetValue())
-        self.umn_web.set_queryformat(self.text_queryformat.GetValue())
+        #self.umn_web.set_queryformat(self.text_queryformat.GetValue())
         self.result ="OK"
         self.end_dialog(self.result)
 
@@ -297,9 +375,6 @@
         # initialize the Dialog
         wxDialog.__init__(self, parent, ID, title, pos, size, style)
 
-         #add all boxes to this top box
-        top = wxBoxSizer(wxVERTICAL)
-
         #  get the web object
         self.tb_map = parent.canvas.Map()
         self.umn_legend = self.tb_map.extension_umn_mapobj.get_legend()
@@ -322,7 +397,6 @@
                               name='keyheight', style=wxSP_ARROW_KEYS)
         box_sizepartHeight.Add(self.text_keysize_height, 2, wxALL, 2)
         box_keysize.Add(box_sizepartHeight, 0, wxALIGN_RIGHT | wxALL, 2)
-        top.Add(box_keysize,0, wxEXPAND |wxALL, 5) 
         
         # create the Keyspacing
         keySpacing= wxStaticBox(self, 1010, _("KeySpacing"), style = 0, name = "KeySpacing Box",   )
@@ -342,7 +416,6 @@
                               name='spacingheight', style=wxSP_ARROW_KEYS)
         box_sizepartHeight.Add(self.text_keyspacing_height, 2, wxALL, 2)
         box_keyspacing.Add(box_sizepartHeight, 0, wxALIGN_RIGHT | wxALL, 2)
-        top.Add(box_keyspacing,0, wxEXPAND |wxALL, 5) 
 
         # color chooser
         box_colorStatic = wxStaticBox(self, 1011, _("ImageColor"),  style = 0, name = "imagecolor")
@@ -358,7 +431,6 @@
         button.SetFocus()
         EVT_BUTTON(self, ID_COLOR_CHANGE, self.OnChangeColor)
         box_color.Add(button, 1, wxEXPAND|wxALL, 5)
-        top.Add(box_color,0, wxEXPAND |wxALL, 5) 
 
         # status
         umn_legend_status= self.umn_legend.get_status(art="string")
@@ -369,7 +441,6 @@
               label='Status', majorDimension=1,
               name='status check', size=wxDefaultSize, style=wxRA_SPECIFY_ROWS)
         self.choice_status.SetStringSelection(umn_legend_status)
-        top.Add(self.choice_status,0, wxEXPAND |wxALL, 5) 
 
         # create the positionbox
         umn_legend_position= self.umn_legend.get_position(art="string")
@@ -380,13 +451,10 @@
               label='Position', majorDimension=1,
               name='position check', size=wxDefaultSize, style=wxRA_SPECIFY_ROWS)
         self.choice_position.SetStringSelection(umn_legend_position)
-        top.Add(self.choice_position,0, wxEXPAND |wxALL, 5) 
         
-        #test button for label
-        button = wxButton(self, ID_LABEL_CHANGE, _("Change Label"))
-        button.SetFocus()
+        # button for label
+        labelbutton = wxButton(self, ID_LABEL_CHANGE, _("Change Label"))
         EVT_BUTTON(self, ID_LABEL_CHANGE, self.OnChangeLabel)
-        top.Add(button, 1, wxEXPAND|wxALL, 5)
         
         #buttons
         box_buttons = wxBoxSizer(wxHORIZONTAL)
@@ -397,6 +465,15 @@
         #set the button funcitons
         EVT_BUTTON(self, wxID_OK, self.OnOK)
         EVT_BUTTON(self, wxID_CANCEL, self.OnCancel)        
+        
+        # compose the final layout
+        top = wxBoxSizer(wxVERTICAL)
+        top.Add(box_keysize,0, wxEXPAND |wxALL, 5) 
+        top.Add(box_keyspacing,0, wxEXPAND |wxALL, 5) 
+        top.Add(box_color,0, wxEXPAND |wxALL, 5) 
+        top.Add(self.choice_status,0, wxEXPAND |wxALL, 5) 
+        top.Add(self.choice_position,0, wxEXPAND |wxALL, 5) 
+        top.Add(labelbutton, 1, wxEXPAND|wxALL, 5)
         top.Add(box_buttons, 0, wxALIGN_RIGHT)
         
         # final layout settings
@@ -405,7 +482,7 @@
     
     def OnChangeLabel(self, event):
         self.umn_label = self.umn_legend.get_label()
-        dialog = Label_Dialog(self, -1, "This is a wxDialog", size=wxSize(350, 200),
+        dialog = Label_Dialog(self, -1, "Legend Label Settings", size=wxSize(350, 200),
                  style = wxDEFAULT_DIALOG_STYLE
                  )
         dialog.CenterOnScreen()
@@ -441,8 +518,10 @@
         self.Show(False)
 
     def OnOK(self, event):
-        self.umn_legend.set_keysize(self.text_keysize_width.GetValue(),self.text_keysize_height.GetValue())
-        self.umn_legend.set_keyspacing(self.text_keyspacing_width.GetValue(),self.text_keyspacing_height.GetValue())
+        self.umn_legend.set_keysize(self.text_keysize_width.GetValue(),
+                                    self.text_keysize_height.GetValue())
+        self.umn_legend.set_keyspacing(self.text_keyspacing_width.GetValue(),
+                                    self.text_keyspacing_height.GetValue())
         self.umn_legend.set_status(self.choice_status.GetStringSelection())
         self.umn_legend.set_position(self.choice_position.GetStringSelection())
         previewcolor = self.previewcolor.GetBackgroundColour()
@@ -463,9 +542,6 @@
         # initialize the Dialog
         wxDialog.__init__(self, parent, ID, title, pos, size, style)
 
-         #add all boxes to this top box
-        top = wxBoxSizer(wxVERTICAL)
-
         #  get the web object
         self.umn_label = parent.umn_label
 
@@ -474,14 +550,11 @@
         box_labelsize = wxStaticBoxSizer(labelsize, wxVERTICAL)
         umn_label_size= self.umn_label.get_size()
         box_size = wxBoxSizer(wxHORIZONTAL)        
-        box_size.Add(wxStaticText(self, -1, _("Size: ")), 0, wxALL, 2)
         self.text_labelsize = wxSpinCtrl(self, -1, 
                               value=str(umn_label_size), max=10, min=0,
                               name='size', style=wxSP_ARROW_KEYS)
         box_size.Add(self.text_labelsize, 2, wxALL, 2)
         box_labelsize.Add(box_size, 0, wxALIGN_RIGHT | wxALL, 2)
-        top.Add(box_labelsize,0, wxEXPAND |wxALL, 5) 
-
 
         # color chooser
         box_colorStatic = wxStaticBox(self, 1011, _("Color"),  style = 0, name = "color")
@@ -497,7 +570,6 @@
         button.SetFocus()
         EVT_BUTTON(self, ID_COLOR_CHANGE, self.OnChangeColor)
         box_color.Add(button, 1, wxEXPAND|wxALL, 5)
-        top.Add(box_color,0, wxEXPAND |wxALL, 5) 
 
         #get the set type
         insidetype = self.umn_label.get_type()
@@ -513,9 +585,7 @@
         self.choice_type = wxChoice(self, 40, (80, 50), choices = sam)
         self.choice_type.SetStringSelection(insidetype)
         box_type.Add(self.choice_type,0, wxEXPAND, wxALL, 5)        
-        top.Add(box_type,0,wxEXPAND |wxALL, 5)
-        
-        
+
         # Offset
         offset= wxStaticBox(self, 1010, _("Offset"), style = 0, name = "Offset Box",   )
         box_offset = wxStaticBoxSizer(offset, wxVERTICAL)
@@ -534,17 +604,68 @@
                               name='offsetY', style=wxSP_ARROW_KEYS)
         box_offsetY.Add(self.text_offsety, 2, wxALL, 2)
         box_offset.Add(box_offsetY, 0, wxALIGN_RIGHT | wxALL, 2)
-        top.Add(box_offset,0, wxEXPAND |wxALL, 5) 
         
-        # offset
+        # partials
         umn_partials = self.umn_label.get_partials()
         self.choice_partials = wxRadioBox(self, -1, choices=["True","False"],
               label='partials', majorDimension=1,
               name='partials check', size=wxDefaultSize, style=wxRA_SPECIFY_ROWS)
         self.choice_partials.SetStringSelection(str(umn_partials))
-        top.Add(self.choice_partials,0, wxEXPAND |wxALL, 5) 
-        
+
+        # force
+        umn_force = self.umn_label.get_force()
+        self.choice_force = wxRadioBox(self, -1, choices=["True","False"],
+              label='force', majorDimension=1,
+              name='force check', size=wxDefaultSize, style=wxRA_SPECIFY_ROWS)
+        self.choice_force.SetStringSelection(str(umn_force))
+
+        # buffer
+        buffer = wxStaticBox(self, 1010, _("Buffer"), style = 0, name = "Buffer Box",   )
+        box_buffer = wxStaticBoxSizer(buffer, wxVERTICAL)
+        umn_buffer= self.umn_label.get_buffer()
+        box_buffertext = wxBoxSizer(wxHORIZONTAL)        
+        self.text_buffer = wxSpinCtrl(self, -1, 
+                              value=str(umn_buffer), max=10, min=0,
+                              name='size', style=wxSP_ARROW_KEYS)
+        box_buffertext.Add(self.text_buffer, 2, wxALL, 2)
+        box_buffer.Add(box_buffertext, 0, wxALIGN_RIGHT | wxALL, 2)
+
+        # minfeaturesize
+        minfeaturesize = wxStaticBox(self, 1010, _("Minfeaturesize"), style = 0,
+                                            name = "Minfeaturesize Box",   )
+        box_minfeaturesize = wxStaticBoxSizer(minfeaturesize, wxVERTICAL)
+        umn_minfeaturesize= self.umn_label.get_minfeaturesize()
+        box_minfeaturesizetext = wxBoxSizer(wxHORIZONTAL)        
+        self.text_minfeaturesize = wxSpinCtrl(self, -1, 
+                              value=str(umn_minfeaturesize), max=10, min=-1,
+                              name='minfeaturesize', style=wxSP_ARROW_KEYS)
+        box_minfeaturesizetext.Add(self.text_minfeaturesize, 2, wxALL, 2)
+        box_minfeaturesize.Add(box_minfeaturesizetext, 0, 
+                                             wxALIGN_RIGHT | wxALL, 2)
+
+        # mindistance
+        mindistance = wxStaticBox(self, 1010, _("Mindistance"), style = 0,
+                                            name = "Mindistance Box",   )
+        box_mindistance = wxStaticBoxSizer(mindistance, wxVERTICAL)
+        umn_mindistance= self.umn_label.get_mindistance()
+        box_mindistancetext = wxBoxSizer(wxHORIZONTAL)        
+        self.text_mindistance = wxSpinCtrl(self, -1, 
+                              value=str(umn_mindistance), max=10, min=-1,
+                              name='mindistance', style=wxSP_ARROW_KEYS)
+        box_mindistancetext.Add(self.text_mindistance, 2, wxALL, 2)
+        box_mindistance.Add(box_mindistancetext, 0, 
+                                             wxALIGN_RIGHT | wxALL, 2)
         
+        # position
+        umn_label_position= self.umn_label.get_position(art="string")
+        possible_choices = []
+        for key in label_position_type:
+            possible_choices.append(label_position_type[key])
+        self.choice_position = wxRadioBox(self, -1, choices=possible_choices,
+              label='Position', majorDimension=1,
+              name='position check', size=wxDefaultSize, style=wxRA_SPECIFY_ROWS)
+        self.choice_position.SetStringSelection(umn_label_position)
+  
         #buttons
         box_buttons = wxBoxSizer(wxHORIZONTAL)
         button = wxButton(self, wxID_OK, _("OK"))
@@ -554,8 +675,31 @@
         #set the button funcitons
         EVT_BUTTON(self, wxID_OK, self.OnOK)
         EVT_BUTTON(self, wxID_CANCEL, self.OnCancel)        
-        top.Add(box_buttons, 0, wxALIGN_RIGHT)
         
+        # compose the Dialog
+        top = wxBoxSizer(wxVERTICAL)
+        
+        top1 = wxBoxSizer(wxHORIZONTAL)
+        top1.Add(box_labelsize,0, wxEXPAND |wxALL, 5) 
+        top1.Add(box_color,0, wxEXPAND |wxALL, 5) 
+        top1.Add(box_minfeaturesize,0, wxEXPAND |wxALL, 5) 
+        
+        top2 = wxBoxSizer(wxHORIZONTAL)
+        top2.Add(box_type,0,wxEXPAND |wxALL, 5)
+        top2.Add(box_offset,0, wxEXPAND |wxALL, 5)   
+        top2.Add(box_mindistance,0, wxEXPAND |wxALL, 5) 
+        
+        top3 = wxBoxSizer(wxHORIZONTAL)
+        top3.Add(self.choice_partials,0, wxEXPAND |wxALL, 5) 
+        top3.Add(box_buffer,0, wxEXPAND |wxALL, 5) 
+        top3.Add(self.choice_force,0, wxEXPAND |wxALL, 5) 
+        
+        top.Add(top1, 0, wxEXPAND)
+        top.Add(top2, 0, wxEXPAND)
+        top.Add(top3, 0, wxEXPAND)
+        top.Add(self.choice_position,0, wxEXPAND |wxALL, 5) 
+        top.Add(box_buttons, 0, wxALIGN_RIGHT)
+
         # final layout settings
         self.SetSizer(top)
         top.Fit(self)
@@ -598,6 +742,14 @@
         previewcolor = self.previewcolor.GetBackgroundColour()
         self.umn_label.get_color().set_rgbcolor(previewcolor.Red(),
                     previewcolor.Green(), previewcolor.Blue())
+        self.umn_label.set_mindistance(self.text_mindistance.GetValue())
+        self.umn_label.set_minfeaturesize(self.text_minfeaturesize.GetValue())
+        self.umn_label.set_position(self.choice_position.GetStringSelection())
+        self.umn_label.set_buffer(self.text_buffer.GetValue())
+        if self.choice_force.GetStringSelection() == "True":
+            self.umn_label.set_force(True)
+        else:
+            self.umn_label.set_force(False)
         self.result ="OK"
         self.end_dialog(self.result)
 
@@ -613,9 +765,6 @@
         # initialize the Dialog
         wxDialog.__init__(self, parent, ID, title, pos, size, style)
 
-         #add all boxes to this top box
-        top = wxBoxSizer(wxVERTICAL)
-
         #  get the web object
         self.tb_map = parent.canvas.Map()
         self.umn_scalebar = self.tb_map.extension_umn_mapobj.get_scalebar()
@@ -634,7 +783,6 @@
         button.SetFocus()
         EVT_BUTTON(self, ID_COLOR_CHANGE, self.OnChangeColor)
         box_color.Add(button, 1, wxEXPAND|wxALL, 5)
-        #top.Add(box_color,0, wxEXPAND |wxALL, 5) 
         # show the two color chooser horizontal
         colorHor = wxBoxSizer(wxHORIZONTAL)
         colorHor.Add(box_color,0, wxEXPAND |wxALL, 5) 
@@ -654,8 +802,6 @@
         EVT_BUTTON(self, ID_IMGCOLOR_CHANGE, self.OnChangeImageColor)
         box_imgcolor.Add(button, 1, wxEXPAND|wxALL, 5)
         colorHor.Add(box_imgcolor,0, wxEXPAND |wxALL, 5)
-        #top.Add(box_imgcolor,0, wxEXPAND |wxALL, 5) 
-        top.Add(colorHor,0, wxEXPAND |wxALL, 5)
         
         # create the intervals
         intervalsStatic = wxStaticBox(self, 1010, _("Intervals"), style = 0, name = "Intervals Box",   )
@@ -678,7 +824,6 @@
               name='style check', size=wxDefaultSize, style=wxRA_SPECIFY_ROWS)
         self.choice_style.SetSelection(umn_scalebar_style)
         hori2.Add(self.choice_style, 1, wxEXPAND|wxALL, 5)
-        top.Add(hori2, 1, wxEXPAND|wxALL, 5)
         
         #create size settings
         try:
@@ -699,7 +844,6 @@
         self.text_height = wxTextCtrl(self, -1, str(insidetxt[1]))
         box_sizepartHeight.Add(self.text_height, 2, wxALL, 4)
         box_size.Add(box_sizepartHeight, 0, wxALIGN_RIGHT | wxALL, 5)
-        top.Add(box_size, 1, wxEXPAND|wxALL, 5)
         
         # status
         umn_scalebar_status= self.umn_scalebar.get_status(art="string")
@@ -710,7 +854,6 @@
               label='Status', majorDimension=1,
               name='status check', size=wxDefaultSize, style=wxRA_SPECIFY_ROWS)
         self.choice_status.SetStringSelection(umn_scalebar_status)
-        top.Add(self.choice_status,0, wxEXPAND |wxALL, 5) 
         
         # position
         umn_scalebar_position= self.umn_scalebar.get_position(art="string")
@@ -721,8 +864,6 @@
               label='Position', majorDimension=1,
               name='position check', size=wxDefaultSize, style=wxRA_SPECIFY_ROWS)
         self.choice_position.SetStringSelection(umn_scalebar_position)
-        top.Add(self.choice_position,0, wxEXPAND |wxALL, 5) 
-        
         
         #get the set unittype
         insideunit = self.umn_scalebar .get_units()
@@ -734,13 +875,11 @@
             sam.append(unit_type[key])
         self.choice_units = wxChoice(self, 40, (80, 50), choices = sam)
         self.choice_units.SetStringSelection(insideunit)
-        box_units.Add(self.choice_units,0, wxEXPAND, wxALL, 5)        
-        top.Add(box_units, 1, wxEXPAND|wxALL, 5)
+        box_units.Add(self.choice_units,0, wxEXPAND, wxALL, 5)    
         
-        #test button for label
-        button = wxButton(self, ID_LABEL_CHANGE, _("Change Label"))
+        # button for label
+        labelbutton = wxButton(self, ID_LABEL_CHANGE, _("Change Label"))
         EVT_BUTTON(self, ID_LABEL_CHANGE, self.OnChangeLabel)
-        top.Add(button, 1, wxEXPAND|wxALL, 5)
         
         #buttons
         box_buttons = wxBoxSizer(wxHORIZONTAL)
@@ -751,7 +890,17 @@
         box_buttons.Add(button, 0, wxALL, 5)
         #set the button funcitons
         EVT_BUTTON(self, wxID_OK, self.OnOK)
-        EVT_BUTTON(self, wxID_CANCEL, self.OnCancel)        
+        EVT_BUTTON(self, wxID_CANCEL, self.OnCancel)      
+      
+        # compose the dialog
+        top = wxBoxSizer(wxVERTICAL)
+        top.Add(colorHor,0, wxEXPAND |wxALL, 5)
+        top.Add(hori2, 1, wxEXPAND|wxALL, 5)
+        top.Add(box_size, 1, wxEXPAND|wxALL, 5)
+        top.Add(self.choice_status,0, wxEXPAND |wxALL, 5) 
+        top.Add(self.choice_position,0, wxEXPAND |wxALL, 5) 
+        top.Add(box_units, 1, wxEXPAND|wxALL, 5)
+        top.Add(labelbutton, 0, wxEXPAND|wxALL, 5)
         top.Add(box_buttons, 0, wxALIGN_RIGHT)
         
         # final layout settings
@@ -761,7 +910,7 @@
     def OnChangeLabel(self, event):
         # set the umn_label for scalebar so the Label_Dialog can be used
         self.umn_label = self.umn_scalebar.get_label()
-        dialog = Label_Dialog(self, -1, "This is a wxDialog", size=wxSize(350, 200),
+        dialog = Label_Dialog(self, -1, "Scalbar Label Settings", size=wxSize(350, 200),
                  style = wxDEFAULT_DIALOG_STYLE
                  )
         dialog.CenterOnScreen()
@@ -833,28 +982,35 @@
 
 
 def scalebarsettings(context):
-    win = Scalebar_Dialog(context.mainwindow, -1, "This is a wxDialog", size=wxSize(350, 200),
+    win = Scalebar_Dialog(context.mainwindow, -1, "Scalebar Settings", size=wxSize(350, 200),
                  style = wxDEFAULT_DIALOG_STYLE
                  )
     win.CenterOnScreen()
     val = win.ShowModal()
 
 def mapsettings(context):
-    win = Map_Dialog(context.mainwindow, -1, "This is a wxDialog", size=wxSize(350, 200),
+    win = Map_Dialog(context.mainwindow, -1, "Map Settings", size=wxSize(350, 200),
                  style = wxDEFAULT_DIALOG_STYLE
                  )
     win.CenterOnScreen()
     val = win.ShowModal()
 
+def outputformatsettings(context):
+    win = OutputFormat_Dialog(context.mainwindow, -1, "OutputFormat Settings", 
+                 size=wxSize(350, 200), style = wxDEFAULT_DIALOG_STYLE
+                 )
+    win.CenterOnScreen()
+    val = win.ShowModal()
+
 def websettings(context):
-    win = Web_Dialog(context.mainwindow, -1, "This is a wxDialog", size=wxSize(350, 200),
+    win = Web_Dialog(context.mainwindow, -1, "Web Settings", size=wxSize(350, 200),
                  style = wxDEFAULT_DIALOG_STYLE
                  )
     win.CenterOnScreen()
     val = win.ShowModal()
 
 def legendsettings(context):
-    win = Legend_Dialog(context.mainwindow, -1, "This is a wxDialog", size=wxSize(350, 200),
+    win = Legend_Dialog(context.mainwindow, -1, "Legend Settings", size=wxSize(350, 200),
                  style = wxDEFAULT_DIALOG_STYLE
                  )
     win.CenterOnScreen()
@@ -889,6 +1045,13 @@
                      helptext = _("Edit the Map Setting")))
 # finally add the new entry to the extensions menu
 mapserver_menu.InsertItem("Map Settings")
+
+# register the new command (OutputFormat Settings Dialog)
+registry.Add(Command("OutputFormat Settings", _("OutputFormat Settings"),
+                     outputformatsettings,
+                     helptext = _("Edit the OutputFormat Setting")))
+# finally add the new entry to the extensions menu
+mapserver_menu.InsertItem("OutputFormat Settings")
 
 # register the new command (Map Settings Dialog)
 registry.Add(Command("Web Settings", _("Web Settings"), websettings,





More information about the Thuban-devel mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)