Changeset 1983
- Timestamp:
- 01/31/11 12:32:32 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/casatoolbar.py
r1982 r1983 168 168 return False 169 169 170 def _new_page(self,next=True): 170 ### Page chages 171 ### go to the previous page 172 def prev_page(self): 173 self.figmgr.toolbar.set_message('plotting the previous page') 174 self._new_page(goback=True) 175 176 ### go to the next page 177 def next_page(self): 178 self.figmgr.toolbar.set_message('plotting the next page') 179 self._new_page(goback=False) 180 181 ### actual plotting of the new page 182 def _new_page(self,goback=False): 171 183 if self.plotter._startrow <= 0: 172 184 msg = "The page counter is reset due to chages of plot settings. " … … 174 186 asaplog.push(msg) 175 187 asaplog.post('WARN') 176 next = True188 goback = False 177 189 178 190 self.plotter._plotter.hold() 179 if not next:191 if goback: 180 192 self._set_prevpage_counter() 181 193 #self.plotter._plotter.clear() 182 194 self.plotter._plot(self.plotter._data) 183 self.set_page num(self._get_pagenum())195 self.set_pagecounter(self._get_pagenum()) 184 196 self.plotter._plotter.release() 185 197 self.plotter._plotter.tidy() 186 198 self.plotter._plotter.show(hardrefresh=False) 187 199 200 ### calculate the panel ID and start row to plot the previous page 188 201 def _set_prevpage_counter(self): 189 202 # set row and panel counters to those of the 1st panel of previous page … … 212 225 del lastpanel,currpnum,prevpnum,start_ipanel 213 226 227 ### refresh the page counter 228 ### refresh the page counter 229 def set_pagecounter(self,page): 230 nwidth = int(numpy.ceil(numpy.log10(max(page,1))))+1 231 nwidth = max(nwidth,4) 232 formatstr = '%'+str(nwidth)+'d' 233 self.show_pagenum(page,formatstr) 234 235 def show_pagenum(self,pagenum,formatstr): 236 # passed to backend dependent class 237 pass 238 214 239 def _get_pagenum(self): 215 240 maxpanel = 16 … … 242 267 self.mode = '' 243 268 self.button = True 244 self.pagenum = None 269 self.pagecount = None 270 CustomToolbarCommon.__init__(self,parent) 271 self.notewin=NotationWindowTkAgg(master=self.canvas) 245 272 self._add_custom_toolbar() 246 self.notewin=NotationWindowTkAgg(master=self.canvas)247 CustomToolbarCommon.__init__(self,parent)248 273 249 274 def _add_custom_toolbar(self): … … 259 284 text='statistics', 260 285 command=self.stat_cal) 261 # page change oparations262 self.lPagetitle = Tk.Label(master=self,text=' Page:',padx=5)263 self.lPagetitle.pack(side=Tk.LEFT)264 self.pagenum = Tk.StringVar(master=self)265 self.lPage = Tk.Label(master=self,textvariable=self.pagenum,266 padx=5,bg='white')267 self.lPage.pack(side=Tk.LEFT,padx=3)268 269 self.bNext=self._NewButton(master=self,270 text=' + ',271 command=self.next_page)272 self.bPrev=self._NewButton(master=self,273 text=' - ',274 command=self.prev_page)275 276 if os.uname()[0] != 'Darwin':277 self.bPrev.config(padx=5)278 self.bNext.config(padx=5)279 286 self.bQuit=self._NewButton(master=self, 280 287 text='Quit', 281 288 command=self.quit, 282 289 side=Tk.RIGHT) 290 291 # page change oparations 292 frPage = Tk.Frame(master=self,borderwidth=2,relief=Tk.GROOVE) 293 frPage.pack(ipadx=2,padx=10,side=Tk.RIGHT) 294 self.lPagetitle = Tk.Label(master=frPage,text='Page:',padx=5) 295 self.lPagetitle.pack(side=Tk.LEFT) 296 self.pagecount = Tk.StringVar(master=frPage) 297 self.lPagecount = Tk.Label(master=frPage, 298 textvariable=self.pagecount, 299 padx=5,bg='white') 300 self.lPagecount.pack(side=Tk.LEFT,padx=3) 301 302 self.bNext=self._NewButton(master=frPage, 303 text=' + ', 304 command=self.next_page) 305 self.bPrev=self._NewButton(master=frPage, 306 text=' - ', 307 command=self.prev_page) 308 309 if os.uname()[0] != 'Darwin': 310 self.bPrev.config(padx=5) 311 self.bNext.config(padx=5) 312 283 313 self.pack(side=Tk.BOTTOM,fill=Tk.BOTH) 284 self.page num.set(' ')314 self.pagecount.set(' '*4) 285 315 286 316 self.disable_button() … … 295 325 b.pack(side=side) 296 326 return b 327 328 def show_pagenum(self,pagenum,formatstr): 329 self.pagecount.set(formatstr % (pagenum)) 297 330 298 331 def spec_show(self): … … 339 372 self._p.register('button_press',self._mod_note) 340 373 341 def prev_page(self):342 self.figmgr.toolbar.set_message('plotting the previous page')343 self._new_page(next=False)344 345 def next_page(self):346 self.figmgr.toolbar.set_message('plotting the next page')347 self._new_page(next=True)348 349 def set_pagenum(self,page):350 nwidth = int(numpy.ceil(numpy.log10(max(page,1))))+1351 nwidth = max(nwidth,4)352 formatstr = '%'+str(nwidth)+'d'353 self.pagenum.set(formatstr % (page))354 355 374 def quit(self): 356 375 self.__disconnect_event()
Note:
See TracChangeset
for help on using the changeset viewer.