예제 #1
0
 def add_title_and_menu(self, title, menu):
     items = [menu]
     if title:
         items.insert(0, title)
     box = Column(items, align='l', spacing=20)
     c = self.center
     box.center = self.center
     self.add(box)
예제 #2
0
 def __init__(self, prompt=None, suffixes=None, **kwds):
     Dialog.__init__(self, **kwds)
     label = None
     d = self.margin
     self.suffixes = suffixes or ()
     up_button = Button(self.up_button_text, action=self.go_up)
     dir_box = DirPathView(self.box_width - up_button.width - 10, self)
     self.dir_box = dir_box
     top_row = Row([dir_box, up_button])
     list_box = FileListView(self.box_width - 16, self)
     self.list_box = list_box
     ctrls = [top_row, list_box]
     prompt = prompt or self.default_prompt
     if prompt:
         label = Label(prompt)
     if self.saving:
         filename_box = TextField(self.box_width)
         filename_box.change_action = self.update
         self.filename_box = filename_box
         ctrls.append(Column([label, filename_box], align='l', spacing=0))
     else:
         if label:
             ctrls.insert(0, label)
     ok_button = Button(self.ok_label,
                        action=self.ok,
                        enable=self.ok_enable)
     self.ok_button = ok_button
     cancel_button = Button("Cancel", action=self.cancel)
     vbox = Column(ctrls, align='l', spacing=d)
     vbox.topleft = (d, d)
     y = vbox.bottom + d
     ok_button.topleft = (vbox.left, y)
     cancel_button.topright = (vbox.right, y)
     self.add(vbox)
     self.add(ok_button)
     self.add(cancel_button)
     self.shrink_wrap()
     self._directory = None
     self.directory = os.getcwd()
     #print "FileDialog: cwd =", repr(self.directory) ###
     if self.saving:
         filename_box.focus()
예제 #3
0
 def __init__(self):
     Dialog.__init__(self)
     emc = EnableMusicControl()
     mvc = MusicVolumeControl()
     controls = Grid([
         [Label("Enable Music"), emc],
         [Label("Music Volume"), mvc],
     ])
     buttons = Button("OK", self.ok)
     contents = Column([controls, buttons], align='r', spacing=20)
     contents.topleft = (20, 20)
     self.add(contents)
     self.shrink_wrap()
예제 #4
0
 def add_title_and_buttons(self, title, buttons):
     menu = Column(buttons, align='l')
     self.add_title_and_menu(title, menu)