示例#1
0
def _request_old_dir(prompt, default_dir):
    from win32com.shell import shell as sh
    import win32com.shell.shellcon as sc
    win_bif_flags = sc.BIF_RETURNONLYFSDIRS  # | sc.BIF_EDITBOX | wc.BIF_VALIDATE
    if default_dir:

        def callback(hwnd, msg, lp, data):
            if msg == sc.BFFM_INITIALIZED:
                api.SendMessage(hwnd, sc.BFFM_SETSELECTION, True,
                                default_dir.path)
    else:
        callback = None
    (idl, name, images) = sh.SHBrowseForFolder(None, None,
                                               win_fix_prompt(prompt),
                                               win_bif_flags, callback)
    if idl:
        return DirRef(sh.SHGetPathFromIDList(idl))
示例#2
0
functions = {}
function_names = [
	'request_old_file',
	'request_old_files',
	'request_new_file',
	'request_old_directory',
	'request_old_directories', 
	'request_new_directory',
]
for name in function_names:
	if hasattr(FileDialogs, name):
		functions[name] = getattr(FileDialogs, name)
	else:
		say("*** Missing function:", name)
	
last_dir = DirRef(path = os.path.abspath(os.path.dirname(sys.argv[0])))
last_name = ""

say("last_dir =", last_dir) ###

class TestWindow(Window):

	file_type = FileType(name = "TIFF Image", suffix = "tiff")

	def __init__(self):
		Window.__init__(self, size = (200, 200))
		self.filt = CheckBox("%ss only" % self.file_type.name)
		#self.multi = CheckBox("Multiple Selection")
		buts = []
		if 'request_old_file' in functions:
			buts.append(Button("Old File", action = self.do_old_file))
示例#3
0
from GUI import View, Button, FileDialogs, Label, Font
from GUI.Files import FileType, DirRef
from Code.UI.Components import *
from Code.UI.SkinSelector import *
from Code.UI.Equipment import *
from Code.UI.Church import *
from Code.UI.AbilitySelect import *
import Units
CHARACTERDIR = DirRef(path = os.path.join("Profiles"))
ViewTypes = enum('LOADSCREEN', 'MAINSCREEN', 'SKINSELECTSCREEN', 'EQUIPMENTSCREEN', 'CHURCHSCREEN', 'ABILITYSCREEN')
class CharacterPanel(View):
	currState = 0
	playerNum = 0
	def setupComponents(self):
		hasCharView = CharacterView(size=self.size, model=self.model)
		hasCharView.setupComponents(self)
		
		ssv = SkinSelectView(size=self.size, model=self.model)
		ssv.setupComponents(self)
		
		ev = EquipmentView(size=self.size, model=self.model)
		ev.setupComponents(self)
		
		ch = ChurchView(size=self.size, model=self.model)
		ch.setupComponents(self)
		
		abilSel = AbilitySelect(size=self.size, model=self.model)
		abilSel.setupComponents(self)
		
		noCharView = View(size=self.size, model=self.model)
示例#4
0
from GUI import application
from GUI.Alerts import stop_alert, ask
from GUI.Files import DirRef, FileRef

import cap.cap_manager
from session import create_session
from term import TextAttribute, TextMode, reserve
import term.term_keyboard
from term.terminal_gui import TerminalGUI
from term.terminal_widget import TerminalWidget
from term_menu import basic_menus
from term_pygui_file_transfer import FileTransferDialog, FileTransferProgressDialog

padding = 10
file_types = None
last_dir = DirRef(path=os.path.abspath(os.path.expanduser("~/.ssh")))


class PasswordDialog(ModalDialog):
    def __init__(self, action, **kwargs):
        title = 'Password'

        self._action = action

        lbl_text = action.get_pass_desc()

        ModalDialog.__init__(self, title=title)

        label = Label(lbl_text)
        self.txt_passwd = TextField(multiline=False, password=True)