Mercurial > traipse_dev
diff orpg/mapper/base_handler.py @ 19:78407d627cba traipse_dev
Beginning of Code Clean-up. Some code untested, may break!
author | sirebral |
---|---|
date | Sat, 25 Jul 2009 17:24:40 -0500 |
parents | 0b8b7e3ed78d |
children | c54768cffbd4 |
line wrap: on
line diff
--- a/orpg/mapper/base_handler.py Tue Jul 21 05:34:16 2009 -0500 +++ b/orpg/mapper/base_handler.py Sat Jul 25 17:24:40 2009 -0500 @@ -45,64 +45,42 @@ #self.Bind(wx.EVT_SIZE, self.on_size) self.Bind(wx.EVT_LEFT_DCLICK, self.on_left_dclick) - """ - def on_size(self,evt): - s = self.GetClientSizeTuple() - self.basesizer.SetDimension(0,0,s[0],s[1]) - """ - def build_ctrls(self): self.basesizer = wx.BoxSizer(wx.HORIZONTAL) self.sizer = wx.BoxSizer(wx.HORIZONTAL) self.buttonsizer = wx.BoxSizer(wx.HORIZONTAL) - self.zoom_in_button = createMaskedButton( self, orpg.dirpath.dir_struct["icon"]+'zoom_in.gif', "Zoom in from x1.0", wx.ID_ANY ) - self.zoom_out_button = createMaskedButton( self, orpg.dirpath.dir_struct["icon"]+'zoom_out.gif', "Zoom out from x1.0", wx.ID_ANY ) - props = createMaskedButton( self, orpg.dirpath.dir_struct["icon"]+'compass.gif', 'Edit map properties', wx.ID_ANY ) - mapopen = createMaskedButton( self, orpg.dirpath.dir_struct["icon"]+'open.bmp', 'Load a map', wx.ID_ANY, '#c0c0c0', wx.BITMAP_TYPE_BMP ) - mapsave = createMaskedButton( self, orpg.dirpath.dir_struct["icon"]+'save.bmp', 'Save the map', wx.ID_ANY, '#c0c0c0', wx.BITMAP_TYPE_BMP ) - - """ - self.buttonsizer.Add(self.zoom_in_button, 0, wx.EXPAND ) - self.buttonsizer.Add(self.zoom_out_button, 0, wx.EXPAND ) - self.buttonsizer.Add(props, 0, wx.EXPAND ) - self.buttonsizer.Add(mapopen, 0, wx.EXPAND ) - self.buttonsizer.Add(mapsave, 0, wx.EXPAND ) - """ - + self.zoom_in_button = createMaskedButton( self, + orpg.dirpath.dir_struct["icon"]+'zoom_in.gif', "Zoom in from x1.0", wx.ID_ANY ) + self.zoom_out_button = createMaskedButton( self, + orpg.dirpath.dir_struct["icon"]+'zoom_out.gif', "Zoom out from x1.0", wx.ID_ANY ) + props = createMaskedButton( self, + orpg.dirpath.dir_struct["icon"]+'compass.gif', 'Edit map properties', wx.ID_ANY ) + mapopen = createMaskedButton( self, + orpg.dirpath.dir_struct["icon"]+'open.bmp', 'Load a map', wx.ID_ANY, '#c0c0c0', wx.BITMAP_TYPE_BMP ) + mapsave = createMaskedButton( self, + orpg.dirpath.dir_struct["icon"]+'save.bmp', 'Save the map', wx.ID_ANY, '#c0c0c0', wx.BITMAP_TYPE_BMP ) self.buttonsizer.Add(self.zoom_in_button, 0, wx.ALIGN_CENTER ) self.buttonsizer.Add(self.zoom_out_button, 0, wx.ALIGN_CENTER ) self.buttonsizer.Add(props, 0, wx.ALIGN_CENTER ) self.buttonsizer.Add(mapopen, 0, wx.ALIGN_CENTER ) self.buttonsizer.Add(mapsave, 0, wx.ALIGN_CENTER ) - - """ - self.SetSizer(self.basesizer) - self.SetAutoLayout(True) - self.Fit() - """ - self.basesizer.Add((3, 0)) self.basesizer.Add( self.sizer, 1, wx.EXPAND) - - #self.basesizer.Add( self.buttonsizer, 0, wx.ALIGN_RIGHT) - self.basesizer.Add((12, 0)) self.basesizer.Add( self.buttonsizer, 0, wx.EXPAND | wx.ALIGN_RIGHT) self.basesizer.Add((3, 0)) - self.Bind(wx.EVT_BUTTON, self.canvas.on_zoom_in, self.zoom_in_button) self.Bind(wx.EVT_BUTTON, self.canvas.on_zoom_out, self.zoom_out_button) self.Bind(wx.EVT_BUTTON, self.map_frame.on_open, mapopen) self.Bind(wx.EVT_BUTTON, self.map_frame.on_save, mapsave) self.Bind(wx.EVT_BUTTON, self.canvas.on_prop, props) - self.SetSizer(self.basesizer) def build_menu(self,label = "Map"): "Menu is built based on the type of grid (rectangle or hex) we have in use." # do main menu - main_menu = wx.Menu(label) # create a menu resource + main_menu = wx.Menu(label) #create a menu resource main_menu.SetTitle(label) item = wx.MenuItem(main_menu, wx.ID_ANY, "&Load Map", "Load Map") self.canvas.Bind(wx.EVT_MENU, self.map_frame.on_open, item)