comparison pyink/MBScene.py @ 943:82321f404b5f

Change the implement to insert window into the toplevel of the spdesktop. However, we not not insert the scene editor after the aloat window since they are created latter.
author wycc
date Mon, 15 Nov 2010 00:53:18 +0800
parents 9ba94c577a6f
children 53b0f8dc2284
comparison
equal deleted inserted replaced
942:a3f2fbf79191 943:82321f404b5f
409 409
410 self.grid = gtk.Table(len(self.layer)+1, 50) 410 self.grid = gtk.Table(len(self.layer)+1, 50)
411 self.scrollwin = gtk.ScrolledWindow() 411 self.scrollwin = gtk.ScrolledWindow()
412 self.scrollwin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) 412 self.scrollwin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
413 self.scrollwin.add_with_viewport(self.grid) 413 self.scrollwin.add_with_viewport(self.grid)
414 self.scrollwin.set_size_request(-1,150)
414 for i in range(1,max): 415 for i in range(1,max):
415 self.grid.attach(gtk.Label('%d'% i), i,i+1,0,1,0,0,0,0) 416 self.grid.attach(gtk.Label('%d'% i), i,i+1,0,1,0,0,0,0)
416 for i in range(1,len(self.layer)+1): 417 for i in range(1,len(self.layer)+1):
417 print "Layer", i 418 print "Layer", i
418 l = self.layer[i-1] 419 l = self.layer[i-1]
466 self.extendScene() 467 self.extendScene()
467 self.grid.show_all() 468 self.grid.show_all()
468 def addButtons(self,hbox): 469 def addButtons(self,hbox):
469 btn = gtk.Button('Edit') 470 btn = gtk.Button('Edit')
470 btn.connect('clicked', self.doEditScene) 471 btn.connect('clicked', self.doEditScene)
471 hbox.pack_start(btn) 472 hbox.pack_start(btn,expand=False,fill=False)
472 btn = gtk.Button('Insert Key') 473 btn = gtk.Button('Insert Key')
473 btn.connect('clicked',self.doInsertKeyScene) 474 btn.connect('clicked',self.doInsertKeyScene)
474 hbox.pack_start(btn) 475 hbox.pack_start(btn,expand=False,fill=False)
475 btn=gtk.Button('Remove Key') 476 btn=gtk.Button('Remove Key')
476 btn.connect('clicked', self.doRemoveScene) 477 btn.connect('clicked', self.doRemoveScene)
477 hbox.pack_start(btn) 478 hbox.pack_start(btn,expand=False,fill=False)
478 btn=gtk.Button('Extend scene') 479 btn=gtk.Button('Extend scene')
479 btn.connect('clicked', self.doExtendScene) 480 btn.connect('clicked', self.doExtendScene)
480 hbox.pack_start(btn) 481 hbox.pack_start(btn,expand=False,fill=False)
481 def onQuit(self, event): 482 def onQuit(self, event):
482 self.OK = False 483 self.OK = False
483 gtk.main_quit() 484 gtk.main_quit()
484 def onOK(self,event): 485 def onOK(self,event):
485 self.OK = True 486 self.OK = True
486 gtk.main_quit() 487 gtk.main_quit()
487 488
488 def onConfirmDelete(self): 489 def onConfirmDelete(self):
489 if self.scenemap == None: 490 if self.scenemap == None:
490 vbox = gtk.VBox() 491 vbox = gtk.VBox(False,0)
491 vbox.pack_start(gtk.Label('Convert the SVG into a MadButterfly SVG file. All current element will be delted')) 492 vbox.pack_start(gtk.Label('Convert the SVG into a MadButterfly SVG file. All current element will be delted'))
492 hbox = gtk.HBox() 493 hbox = gtk.HBox(False,0)
493 self.button = gtk.Button('OK') 494 self.button = gtk.Button('OK')
494 hbox.pack_start(self.button) 495 hbox.pack_start(self.button,expand=False,fill=False)
495 self.button.connect('clicked', self.onOK) 496 self.button.connect('clicked', self.onOK)
496 self.button = gtk.Button('Cancel') 497 self.button = gtk.Button('Cancel')
497 hbox.pack_start(self.button) 498 hbox.pack_start(self.button,expand=False,fill=False)
498 self.button.connect("clicked", self.onQuit) 499 self.button.connect("clicked", self.onQuit)
499 vbox.pack_start(hbox) 500 vbox.pack_start(hbox,expand=False,fill=False)
500 self.window.add(vbox) 501 self.window.add(vbox)
501 self.window.show_all() 502 self.window.show_all()
502 gtk.main() 503 gtk.main()
503 self.window.remove(vbox) 504 self.window.remove(vbox)
504 505
505 506
506 def show(self): 507 def show(self):
507 self.OK = True 508 self.OK = True
508 self.parseScene() 509 self.parseScene()
509 self.showGrid() 510 self.showGrid()
511 vbox = gtk.VBox(False,0)
512 self.desktop.getToplevel().child.child.pack_end(vbox,expand=False)
513 self.window = vbox
510 #self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) 514 #self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
511 #self.window.connect("destroy", gtk.main_quit) 515 #self.window.connect("destroy", gtk.main_quit)
512 #self.window.set_position(gtk.WIN_POS_MOUSE) 516 #self.window.set_position(gtk.WIN_POS_MOUSE)
513 if self.scenemap == None: 517 if self.scenemap == None:
514 self.onConfirmDelete() 518 self.onConfirmDelete()
515 if self.OK: 519 if self.OK:
516 vbox = gtk.VBox() 520 vbox = gtk.VBox(False,0)
517 self.window.add(vbox) 521 self.window.pack_start(vbox,expand=False)
518 vbox.add(self.scrollwin) 522 vbox.pack_start(self.scrollwin,expand=False)
519 self.vbox = vbox 523 self.vbox = vbox
520 hbox=gtk.HBox() 524 hbox=gtk.HBox(False,0)
521 self.addButtons(hbox) 525 self.addButtons(hbox)
522 vbox.add(hbox) 526 vbox.pack_start(hbox,expand=False)
523 else: 527 else:
524 return 528 return
525 529
526 self.window.set_size_request(600,200) 530 #self.window.set_size_request(600,200)
527 531
528 self.window.show_all() 532 self.window.show_all()
529 533
530 534