예제 #1
0
파일: gui.py 프로젝트: gb-archive/awake
    def selectRom(self):
        filename = askopenfilename(title="Select ROM file", parent=self, filetypes=[('Gameboy rom files (*.gb)', '*.gb'), ('Gameboy Color rom files (*.gbc)', '*.gbc'), ('All files', '*.*')])
        if not filename:
            return

        fresh = MainWindow(getTkRoot(), filename)
        fresh.geometry(self.geometry())
        self.destroy()
예제 #2
0
파일: export.py 프로젝트: amorri40/awake
    def __init__(self, parent=None, proj=None):
        if not parent:
            parent = getTkRoot()
        tk.Toplevel.__init__(self, parent)

        assert proj
        self.task = ExportTask(proj)

        self.resizable(False, False)
        self.title('Awake Export')

        frame = ttk.Frame(self)
        frame.pack(fill='both')

        self.mode_radios = RadioGroup(frame, 'What', self.task.modes, 'flow')
        self.mode_radios.grid(row=1, column=1, columnspan=2, sticky='NESW')

        self.scope_var = tk.StringVar()
        group = ttk.LabelFrame(frame, text='From where')
        group.grid(row=2, column=1, columnspan=2)
        radio = ttk.Radiobutton(group, text='All banks', variable=self.scope_var, value='all')
        radio.grid(row=1, column=1, columnspan=2, sticky='NESW')
        radio = ttk.Radiobutton(group, text='Single bank', variable=self.scope_var, value='bank')
        radio.grid(row=2, column=1, sticky='NESW')
        self.bank_select = BankSelect(group, proj)
        self.bank_select.var.trace('w', self.enableBank)
        self.bank_select.grid(row=2, column=2, sticky='NESW')
        radio = ttk.Radiobutton(group, text='Single procedure', variable=self.scope_var, value='proc')
        radio.grid(row=3, column=1, sticky='NESW')
        self.proc_address = tk.StringVar()
        self.proc_address.set("100")
        self.proc_address.trace('w', self.enableProc)
        address = ttk.Entry(group, textvariable=self.proc_address, width=10)
        address.grid(row=3, column=2, sticky='NESW')
        self.scope_var.set(self.task.scope)

        self.status = ttk.Label(frame, text='')
        self.status.grid(row=3, column=1, columnspan=2, sticky='NESW')
        self.progressbar = ttk.Progressbar(frame, orient="horizontal", mode="determinate")
        self.progressbar.grid(row=4, column=1, columnspan=2, sticky='NESW')

        self.export_button = ttk.Button(frame)
        self.export_button.grid(row=5, column=2, columnspan=1, sticky='NESW')
        self.enableExport()
        self.close_button = ttk.Button(frame, text="Close", command=self.quit)
        self.close_button.grid(row=5, column=1, sticky='NESW')
        self.bind('<Return>', self.export)
        self.bind('<Escape>', self.quit)

        self.protocol("WM_DELETE_WINDOW", self.quit)
예제 #3
0
    def __init__(self, parent, proj):
        if not parent:
            parent = getTkRoot()
        tk.Toplevel.__init__(self, parent)

        self.title("Awake Server")

        frame = ttk.Frame(self)
        frame.pack(fill='x')

        self.log = LogFrame(self)
        self.server_frame = ServerFrame(frame, self.log, proj)
        self.server_frame.pack(side='left', fill='y', padx=10, pady=10)

        self.log.pack(side='bottom', fill='both', expand=True)

        self.protocol("WM_DELETE_WINDOW", self.quit)
예제 #4
0
파일: server.py 프로젝트: amorri40/awake
    def __init__(self, parent, proj):
        if not parent:
            parent = getTkRoot()
        tk.Toplevel.__init__(self, parent)

        self.title("Awake Server")

        frame = ttk.Frame(self)
        frame.pack(fill='x')

        self.log = LogFrame(self)
        self.server_frame = ServerFrame(frame, self.log, proj)
        self.server_frame.pack(side='left', fill='y', padx=10, pady=10)

        self.log.pack(side='bottom', fill='both', expand=True)

        self.protocol("WM_DELETE_WINDOW", self.quit)
예제 #5
0
파일: gui.py 프로젝트: gb-archive/awake
    def __init__(self, parent=None, filename=None, url=None, config_file=None):
        if not parent:
            parent = getTkRoot()
        tk.Toplevel.__init__(self, parent)
        self.parent = parent

        title = "Awake"
        if filename:
            title += ' - ' + os.path.basename(filename)
        self.title(title)

        if filename:
            self.romconfig=Config(filename, rom=True)
            self.proj = Project(filename, config_file)
            if self.proj.config.get(['Autostart-Server']):
                self.showServer()
        else:
            self.proj = None

        self.panes = tk.PanedWindow(self, orient='horizontal', sashwidth=10)
        self.panes.pack(side='top', fill='both', expand=True)

        self.tool_pane = ttk.Frame(self.panes)
        self.panes.add(self.tool_pane)
        self.main_pane = ttk.Frame(self.panes)
        self.panes.add(self.main_pane)

        toolbar = ttk.Frame(self.main_pane)
        toolbar.pack(side='top', fill='x', padx=5, pady=5)

        open_button = ttk.Button(toolbar, text="Open...", command=self.selectRom)
        open_button.pack(side='left')
        
        self.history = History(toolbar)
        self.history.pack(side='left')

        self.server_button = ttk.Button(toolbar, text="Start server...", width=15, command=self.showServer)
        self.server_button.pack(side='right')
        self.export_button = ttk.Button(toolbar, text="Export...", width=10, command=self.showExport)
        self.export_button.pack(side='right')

        self.main = MainFrame(self.main_pane, self.proj)
        self.main.pack(side='top', fill='both', expand=True)
        self.main.setLinkCallback(self.history.navigate)
        self.history.setOpenPageCallback(self.main.openPage)

        #bank_frame = ttk.Frame(self.tool_pane)
        #bank_frame.pack(side='top', fill='x', padx=5, pady=5)

        #self.bank_select = ttk.Combobox(bank_frame, state='readonly', values=['All banks', 'Bank 00', 'Bank 01'], width=10)
        #self.bank_select.pack(side='left', fill='x', expand=True)

        #bank_names_button = ttk.Button(bank_frame, text='...', width=3)
        #bank_names_button.pack(side='left')

        #symbol_frame = ttk.Frame(self.tool_pane)
        #symbol_frame.pack(side='top', fill='x')

        #self.symbol_list = tk.Listbox(symbol_frame, relief='flat', highlightthickness=0)
        #self.symbol_list.pack(side='left', fill='both', expand=True)
        #symbol_sb = ttk.Scrollbar(symbol_frame, orient="vertical", command=self.symbol_list.yview)
        #symbol_sb.pack(side="right", fill="y")
        #self.symbol_list.configure(yscrollcommand=symbol_sb.set)

        self.protocol("WM_DELETE_WINDOW", self.quit)

        if not url and self.proj:
            url = self.romconfig.get(['UI','Default-Page'])

        if url:
            self.history.navigate(url)

        if not self.proj:
            self.export_button.configure(state='disabled')
            self.server_button.configure(state='disabled')
            self.history.disable()