コード例 #1
0
ファイル: demo2.py プロジェクト: shaik9/rdrive
	def add_field(self, label, pos):
		lbl = Label(label)
		lbl.rect.topleft = (200, pos)
		self.add(lbl)
		fld = TextField(150)
		fld.rect.topleft = (250, pos)
		fld.enter_action = self.ok
		self.add(fld)
		return fld
コード例 #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, 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()