Mercurial > traipse_dev
comparison 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 |
comparison
equal
deleted
inserted
replaced
18:67b900deb35c | 19:78407d627cba |
---|---|
43 self.build_ctrls() | 43 self.build_ctrls() |
44 self.build_menu() | 44 self.build_menu() |
45 #self.Bind(wx.EVT_SIZE, self.on_size) | 45 #self.Bind(wx.EVT_SIZE, self.on_size) |
46 self.Bind(wx.EVT_LEFT_DCLICK, self.on_left_dclick) | 46 self.Bind(wx.EVT_LEFT_DCLICK, self.on_left_dclick) |
47 | 47 |
48 """ | |
49 def on_size(self,evt): | |
50 s = self.GetClientSizeTuple() | |
51 self.basesizer.SetDimension(0,0,s[0],s[1]) | |
52 """ | |
53 | |
54 def build_ctrls(self): | 48 def build_ctrls(self): |
55 self.basesizer = wx.BoxSizer(wx.HORIZONTAL) | 49 self.basesizer = wx.BoxSizer(wx.HORIZONTAL) |
56 self.sizer = wx.BoxSizer(wx.HORIZONTAL) | 50 self.sizer = wx.BoxSizer(wx.HORIZONTAL) |
57 self.buttonsizer = wx.BoxSizer(wx.HORIZONTAL) | 51 self.buttonsizer = wx.BoxSizer(wx.HORIZONTAL) |
58 | 52 |
59 self.zoom_in_button = createMaskedButton( self, orpg.dirpath.dir_struct["icon"]+'zoom_in.gif', "Zoom in from x1.0", wx.ID_ANY ) | 53 self.zoom_in_button = createMaskedButton( self, |
60 self.zoom_out_button = createMaskedButton( self, orpg.dirpath.dir_struct["icon"]+'zoom_out.gif', "Zoom out from x1.0", wx.ID_ANY ) | 54 orpg.dirpath.dir_struct["icon"]+'zoom_in.gif', "Zoom in from x1.0", wx.ID_ANY ) |
61 props = createMaskedButton( self, orpg.dirpath.dir_struct["icon"]+'compass.gif', 'Edit map properties', wx.ID_ANY ) | 55 self.zoom_out_button = createMaskedButton( self, |
62 mapopen = createMaskedButton( self, orpg.dirpath.dir_struct["icon"]+'open.bmp', 'Load a map', wx.ID_ANY, '#c0c0c0', wx.BITMAP_TYPE_BMP ) | 56 orpg.dirpath.dir_struct["icon"]+'zoom_out.gif', "Zoom out from x1.0", wx.ID_ANY ) |
63 mapsave = createMaskedButton( self, orpg.dirpath.dir_struct["icon"]+'save.bmp', 'Save the map', wx.ID_ANY, '#c0c0c0', wx.BITMAP_TYPE_BMP ) | 57 props = createMaskedButton( self, |
64 | 58 orpg.dirpath.dir_struct["icon"]+'compass.gif', 'Edit map properties', wx.ID_ANY ) |
65 """ | 59 mapopen = createMaskedButton( self, |
66 self.buttonsizer.Add(self.zoom_in_button, 0, wx.EXPAND ) | 60 orpg.dirpath.dir_struct["icon"]+'open.bmp', 'Load a map', wx.ID_ANY, '#c0c0c0', wx.BITMAP_TYPE_BMP ) |
67 self.buttonsizer.Add(self.zoom_out_button, 0, wx.EXPAND ) | 61 mapsave = createMaskedButton( self, |
68 self.buttonsizer.Add(props, 0, wx.EXPAND ) | 62 orpg.dirpath.dir_struct["icon"]+'save.bmp', 'Save the map', wx.ID_ANY, '#c0c0c0', wx.BITMAP_TYPE_BMP ) |
69 self.buttonsizer.Add(mapopen, 0, wx.EXPAND ) | |
70 self.buttonsizer.Add(mapsave, 0, wx.EXPAND ) | |
71 """ | |
72 | |
73 self.buttonsizer.Add(self.zoom_in_button, 0, wx.ALIGN_CENTER ) | 63 self.buttonsizer.Add(self.zoom_in_button, 0, wx.ALIGN_CENTER ) |
74 self.buttonsizer.Add(self.zoom_out_button, 0, wx.ALIGN_CENTER ) | 64 self.buttonsizer.Add(self.zoom_out_button, 0, wx.ALIGN_CENTER ) |
75 self.buttonsizer.Add(props, 0, wx.ALIGN_CENTER ) | 65 self.buttonsizer.Add(props, 0, wx.ALIGN_CENTER ) |
76 self.buttonsizer.Add(mapopen, 0, wx.ALIGN_CENTER ) | 66 self.buttonsizer.Add(mapopen, 0, wx.ALIGN_CENTER ) |
77 self.buttonsizer.Add(mapsave, 0, wx.ALIGN_CENTER ) | 67 self.buttonsizer.Add(mapsave, 0, wx.ALIGN_CENTER ) |
78 | |
79 """ | |
80 self.SetSizer(self.basesizer) | |
81 self.SetAutoLayout(True) | |
82 self.Fit() | |
83 """ | |
84 | |
85 self.basesizer.Add((3, 0)) | 68 self.basesizer.Add((3, 0)) |
86 self.basesizer.Add( self.sizer, 1, wx.EXPAND) | 69 self.basesizer.Add( self.sizer, 1, wx.EXPAND) |
87 | |
88 #self.basesizer.Add( self.buttonsizer, 0, wx.ALIGN_RIGHT) | |
89 | |
90 self.basesizer.Add((12, 0)) | 70 self.basesizer.Add((12, 0)) |
91 self.basesizer.Add( self.buttonsizer, 0, wx.EXPAND | wx.ALIGN_RIGHT) | 71 self.basesizer.Add( self.buttonsizer, 0, wx.EXPAND | wx.ALIGN_RIGHT) |
92 self.basesizer.Add((3, 0)) | 72 self.basesizer.Add((3, 0)) |
93 | |
94 self.Bind(wx.EVT_BUTTON, self.canvas.on_zoom_in, self.zoom_in_button) | 73 self.Bind(wx.EVT_BUTTON, self.canvas.on_zoom_in, self.zoom_in_button) |
95 self.Bind(wx.EVT_BUTTON, self.canvas.on_zoom_out, self.zoom_out_button) | 74 self.Bind(wx.EVT_BUTTON, self.canvas.on_zoom_out, self.zoom_out_button) |
96 self.Bind(wx.EVT_BUTTON, self.map_frame.on_open, mapopen) | 75 self.Bind(wx.EVT_BUTTON, self.map_frame.on_open, mapopen) |
97 self.Bind(wx.EVT_BUTTON, self.map_frame.on_save, mapsave) | 76 self.Bind(wx.EVT_BUTTON, self.map_frame.on_save, mapsave) |
98 self.Bind(wx.EVT_BUTTON, self.canvas.on_prop, props) | 77 self.Bind(wx.EVT_BUTTON, self.canvas.on_prop, props) |
99 | |
100 self.SetSizer(self.basesizer) | 78 self.SetSizer(self.basesizer) |
101 | 79 |
102 def build_menu(self,label = "Map"): | 80 def build_menu(self,label = "Map"): |
103 "Menu is built based on the type of grid (rectangle or hex) we have in use." | 81 "Menu is built based on the type of grid (rectangle or hex) we have in use." |
104 # do main menu | 82 # do main menu |
105 main_menu = wx.Menu(label) # create a menu resource | 83 main_menu = wx.Menu(label) #create a menu resource |
106 main_menu.SetTitle(label) | 84 main_menu.SetTitle(label) |
107 item = wx.MenuItem(main_menu, wx.ID_ANY, "&Load Map", "Load Map") | 85 item = wx.MenuItem(main_menu, wx.ID_ANY, "&Load Map", "Load Map") |
108 self.canvas.Bind(wx.EVT_MENU, self.map_frame.on_open, item) | 86 self.canvas.Bind(wx.EVT_MENU, self.map_frame.on_open, item) |
109 main_menu.AppendItem(item) | 87 main_menu.AppendItem(item) |
110 item = wx.MenuItem(main_menu, wx.ID_ANY, "&Save Map", "Save Map") | 88 item = wx.MenuItem(main_menu, wx.ID_ANY, "&Save Map", "Save Map") |