Exemplo n.º 1
0
    def __init__(self, parent):
        dialog = Gtk.Dialog(
            "Key/mouse input", parent,
            Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
            ("Close", Gtk.ResponseType.CLOSE))

        entry = Gtk.Entry()
        entry.connect("activate", self._entry_cb)
        insert = create_button("Insert", self._entry_cb)
        insert.set_tooltip_text("Insert given text to Hatari window")
        enter = create_button("Enter key", self._enter_cb)
        enter.set_tooltip_text("Simulate Enter key press")

        hbox1 = Gtk.HBox()
        hbox1.add(Gtk.Label(label="Text:"))
        hbox1.add(entry)
        hbox1.add(insert)
        hbox1.add(enter)
        dialog.vbox.add(hbox1)

        rclick = Gtk.Button("Right click")
        rclick.connect("pressed", self._rightpress_cb)
        rclick.connect("released", self._rightrelease_cb)
        rclick.set_tooltip_text("Simulate Atari right button press & release")
        dclick = create_button("Double click", self._doubleclick_cb)
        dclick.set_tooltip_text("Simulate Atari left button double-click")

        hbox2 = Gtk.HBox()
        hbox2.add(dclick)
        hbox2.add(rclick)
        dialog.vbox.add(hbox2)

        dialog.show_all()
        self.dialog = dialog
        self.entry = entry
Exemplo n.º 2
0
    def __init__(self, parent):
        self.savedpoints = None
        hbox1 = Gtk.HBox()
        hbox1.add(create_button("Load", self._load_traces))
        hbox1.add(create_button("Clear", self._clear_traces))
        hbox1.add(create_button("Save", self._save_traces))
        hbox2 = Gtk.HBox()
        vboxes = []
        for idx in (0, 1, 2, 3):
            vboxes.append(Gtk.VBox())
            hbox2.add(vboxes[idx])

        count = 0
        per_side = (len(self.tracepoints) + 3) // 4
        self.tracewidgets = {}
        for trace in self.tracepoints:
            name = trace.replace("_", "-")
            widget = Gtk.CheckButton(name)
            self.tracewidgets[trace] = widget
            vboxes[count // per_side].pack_start(widget, False, True, 0)
            count += 1

        dialog = Gtk.Dialog(
            "Trace settings", parent,
            Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
            (Gtk.STOCK_APPLY, Gtk.ResponseType.APPLY, Gtk.STOCK_CLOSE,
             Gtk.ResponseType.CLOSE))
        dialog.vbox.add(hbox1)
        dialog.vbox.add(Gtk.Label(label="Select trace points:"))
        dialog.vbox.add(hbox2)
        dialog.vbox.show_all()
        self.dialog = dialog
Exemplo n.º 3
0
    def __init__(self, parent):
        dialog = gtk.Dialog("Key/mouse input", parent,
            gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
            ("Close", gtk.RESPONSE_CLOSE))
        
        entry = gtk.Entry()
        entry.connect("activate", self._entry_cb)
        insert = create_button("Insert", self._entry_cb)
        insert.set_tooltip_text("Insert given text to Hatari window")
        enter = create_button("Enter key", self._enter_cb)
        enter.set_tooltip_text("Simulate Enter key press")

        hbox1 = gtk.HBox()
        hbox1.add(gtk.Label("Text:"))
        hbox1.add(entry)
        hbox1.add(insert)
        hbox1.add(enter)
        dialog.vbox.add(hbox1)

        rclick = gtk.Button("Right click")
        rclick.connect("pressed", self._rightpress_cb)
        rclick.connect("released", self._rightrelease_cb)
        rclick.set_tooltip_text("Simulate Atari right button press & release")
        dclick = create_button("Double click", self._doubleclick_cb)
        dclick.set_tooltip_text("Simulate Atari left button double-click")

        hbox2 = gtk.HBox()
        hbox2.add(dclick)
        hbox2.add(rclick)
        dialog.vbox.add(hbox2)

        dialog.show_all()
        self.dialog = dialog
        self.entry = entry
Exemplo n.º 4
0
    def __init__(self, parent):
        self.savedpoints = None
        hbox1 = gtk.HBox()
        hbox1.add(create_button("Load", self._load_traces))
        hbox1.add(create_button("Clear", self._clear_traces))
        hbox1.add(create_button("Save", self._save_traces))
        hbox2 = gtk.HBox()
        vboxes = []
        for idx in (0,1,2,3):
            vboxes.append(gtk.VBox())
            hbox2.add(vboxes[idx])

        count = 0
        per_side = (len(self.tracepoints)+3)/4
        self.tracewidgets = {}
        for trace in self.tracepoints:
            name = trace.replace("_", "-")
            widget = gtk.CheckButton(name)
            self.tracewidgets[trace] = widget
            vboxes[count/per_side].pack_start(widget, False, True)
            count += 1
        
        dialog = gtk.Dialog("Trace settings", parent,
            gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
            (gtk.STOCK_APPLY,  gtk.RESPONSE_APPLY,
             gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE))
        dialog.vbox.add(hbox1)
        dialog.vbox.add(gtk.Label("Select trace points:"))
        dialog.vbox.add(hbox2)
        dialog.vbox.show_all()
        self.dialog = dialog
Exemplo n.º 5
0
    def create_top_buttons(self, box):
        self.stop_button = create_toggle("Stop", self.stop_cb)
        box.add(self.stop_button)

        monitor = create_button("Monitor...", self.monitor_cb)
        box.add(monitor)
        
        buttons = (
            ("<<<", "Page_Up",  -Constants.MOVE_MAX),
            ("<<",  "Up",       -Constants.MOVE_MED),
            ("<",   "Left",     -Constants.MOVE_MIN),
            (">",   "Right",     Constants.MOVE_MIN),
            (">>",  "Down",      Constants.MOVE_MED),
            (">>>", "Page_Down", Constants.MOVE_MAX)
        )
        self.keys = {}
        for label, keyname, offset in buttons:
            button = create_button(label, self.set_address_offset, offset)
            keyval = gtk.gdk.keyval_from_name(keyname)
            self.keys[keyval] =  offset
            box.add(button)

        # to middle of <<>> buttons
        address_entry = self.address.get_address_entry()
        box.pack_start(address_entry, False)
        box.reorder_child(address_entry, 5)
Exemplo n.º 6
0
    def __init__(self, parent):
        self.savedpoints = "none"
        hbox1 = gtk.HBox()
        hbox1.add(create_button("Load", self._load_traces))
        hbox1.add(create_button("Clear", self._clear_traces))
        hbox1.add(create_button("Save", self._save_traces))
        hbox2 = gtk.HBox()
        vboxes = []
        for idx in (0, 1, 2, 3):
            vboxes.append(gtk.VBox())
            hbox2.add(vboxes[idx])

        count = 0
        per_side = (len(self.tracepoints) + 3) / 4
        self.tracewidgets = {}
        for trace in self.tracepoints:
            name = trace.replace("_", "-")
            widget = gtk.CheckButton(name)
            self.tracewidgets[trace] = widget
            vboxes[count / per_side].pack_start(widget, False, True)
            count += 1

        dialog = gtk.Dialog("Trace settings", parent,
                            gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
                            (gtk.STOCK_APPLY, gtk.RESPONSE_APPLY,
                             gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE))
        dialog.vbox.add(hbox1)
        dialog.vbox.add(gtk.Label("Select trace points:"))
        dialog.vbox.add(hbox2)
        dialog.vbox.show_all()
        self.dialog = dialog
Exemplo n.º 7
0
    def create_top_buttons(self, box):
        self.stop_button = create_toggle("Stop", self.stop_cb)
        box.add(self.stop_button)

        monitor = create_button("Monitor...", self.monitor_cb)
        box.add(monitor)
        
        buttons = (
            ("<<<", "Page_Up",  -Constants.MOVE_MAX),
            ("<<",  "Up",       -Constants.MOVE_MED),
            ("<",   "Left",     -Constants.MOVE_MIN),
            (">",   "Right",     Constants.MOVE_MIN),
            (">>",  "Down",      Constants.MOVE_MED),
            (">>>", "Page_Down", Constants.MOVE_MAX)
        )
        self.keys = {}
        for label, keyname, offset in buttons:
            button = create_button(label, self.set_address_offset, offset)
            keyval = gtk.gdk.keyval_from_name(keyname)
            self.keys[keyval] =  offset
            box.add(button)

        # to middle of <<>> buttons
        address_entry = self.address.get_address_entry()
        box.pack_start(address_entry, False)
        box.reorder_child(address_entry, 5)
Exemplo n.º 8
0
    def __init__(self, parent):
        dialog = gtk.Dialog("Key/mouse input", parent,
                            gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
                            ("Close", gtk.RESPONSE_CLOSE))

        tips = gtk.Tooltips()
        entry = gtk.Entry()
        entry.connect("activate", self._entry_cb)
        insert = create_button("Insert", self._entry_cb)
        tips.set_tip(insert, "Insert text to Hatari window")

        hbox1 = gtk.HBox()
        hbox1.add(gtk.Label("Text:"))
        hbox1.add(entry)
        hbox1.add(insert)
        dialog.vbox.add(hbox1)

        rclick = gtk.Button("Rightclick")
        tips.set_tip(rclick, "Simulate Atari left button double-click")
        rclick.connect("pressed", self._rightpress_cb)
        rclick.connect("released", self._rightrelease_cb)
        dclick = create_button("Doubleclick", self._doubleclick_cb)
        tips.set_tip(dclick, "Simulate Atari rigth button click")

        hbox2 = gtk.HBox()
        hbox2.add(rclick)
        hbox2.add(dclick)
        dialog.vbox.add(hbox2)

        dialog.show_all()
        self.dialog = dialog
        self.entry = entry
Exemplo n.º 9
0
    def _fsel_box(self, label, path, action):
        fsel = gtk.FileChooserButton(label)
        # Hatari cannot access URIs
        fsel.set_local_only(True)
        fsel.set_width_chars(12)
        fsel.set_action(action)
        if path:
            fsel.set_filename(path)
        eject = create_button("Eject", self._eject, fsel)

        box = gtk.HBox()
        box.pack_start(fsel)
        box.pack_start(eject, False, False)
        return (fsel, box)
Exemplo n.º 10
0
    def _get_container(self, actions, horiz = True):
        "return Gtk container with the specified actions or None for no actions"
        if not actions:
            return None

        #print "ACTIONS:", actions
        if len(actions) > 1:
            bar = gtk.Toolbar()
            if horiz:
                bar.set_orientation(gtk.ORIENTATION_HORIZONTAL)
            else:
                bar.set_orientation(gtk.ORIENTATION_VERTICAL)
            bar.set_style(gtk.TOOLBAR_BOTH)
            # disable overflow menu to get toolbar sized correctly for panels
            bar.set_show_arrow(False)
            bar.set_tooltips(True)
        else:
            bar = None
        
        tooltips = gtk.Tooltips()
        for action in actions:
            #print action
            offset = action.find("=")
            if offset >= 0:
                # handle "<name>=<keycode>" action specification
                name = action[:offset]
                text = action[offset+1:]
                (widget, tip) = self._create_key_control(name, text)
                widget.set_tooltip(tooltips, "Insert " + tip)
            elif action == "|":
                widget = gtk.SeparatorToolItem()
            elif action == "close":
                if bar:
                    widget = create_toolbutton(gtk.STOCK_CLOSE, self._close_cb)
                else:
                    widget = create_button("Close", self._close_cb)
            else:
                widget = self.actions.get_action(action).create_tool_item()
            if not widget:
                continue
            if bar:
                if action != "|":
                    widget.set_expand(True)
                bar.insert(widget, -1)
        if bar:
            return bar
        return widget
Exemplo n.º 11
0
    def _create_dialog(self, config):
        table, self.dialog = create_table_dialog(self.parent, "Floppy images",
                                                 4, 2)

        row = 0
        self.floppy = []
        path = config.get_floppydir()
        for drive in ("A", "B"):
            label = "Disk %c:" % drive
            fsel = gtk.FileChooserButton(label)
            # Hatari cannot access URIs
            fsel.set_local_only(True)
            fsel.set_width_chars(12)
            filename = config.get_floppy(row)
            if filename:
                fsel.set_filename(filename)
            elif path:
                fsel.set_current_folder(path)
            self.floppy.append(fsel)

            eject = create_button("Eject", self._eject, fsel)
            box = gtk.HBox()
            box.pack_start(fsel)
            box.pack_start(eject, False, False)
            table_add_widget_row(table, row, label, box)
            row += 1

        tips = gtk.Tooltips()

        protect = gtk.combo_box_new_text()
        for text in config.get_protection_types():
            protect.append_text(text)
        protect.set_active(config.get_floppy_protection())
        tips.set_tip(protect, "Write protect floppy image contents")
        table_add_widget_row(table, row, "Write protection:", protect)

        row += 1
        slowfdc = gtk.CheckButton("Slow floppy access")
        slowfdc.set_active(config.get_slowfdc())
        tips.set_tip(slowfdc, "May be required by some rare game/demo")
        table_add_widget_row(table, row, None, slowfdc)

        table.show_all()

        self.protect = protect
        self.slowfdc = slowfdc
Exemplo n.º 12
0
    def create_bottom_buttons(self, box):
        radios = (("Registers", Constants.REGISTERS),
                  ("Memdump", Constants.MEMDUMP), ("Disasm", Constants.DISASM))
        group = None
        for label, mode in radios:
            button = Gtk.RadioButton(label=label, group=group, can_focus=False)
            if not group:
                group = button
            button.connect("toggled", self.dumpmode_cb, mode)
            box.add(button)
        group.set_active(True)

        dialogs = (("Memload...", self.memload_cb),
                   ("Memsave...", self.memsave_cb), ("Options...",
                                                     self.options_cb))
        for label, cb in dialogs:
            button = create_button(label, cb)
            box.add(button)
Exemplo n.º 13
0
    def _get_container(self, actions, horiz = True):
        "return Gtk container with the specified actions or None for no actions"
        if not actions:
            return None

        #print("ACTIONS:", actions)
        if len(actions) > 1:
            bar = gtk.Toolbar()
            if horiz:
                bar.set_orientation(gtk.ORIENTATION_HORIZONTAL)
            else:
                bar.set_orientation(gtk.ORIENTATION_VERTICAL)
            bar.set_style(gtk.TOOLBAR_BOTH)
            # disable overflow menu to get toolbar sized correctly for panels
            bar.set_show_arrow(False)
        else:
            bar = None
        
        for action in actions:
            #print(action)
            offset = action.find("=")
            if offset >= 0:
                # handle "<name>=<keycode>" action specification
                name = action[:offset]
                text = action[offset+1:]
                widget = self._create_key_control(name, text)
            elif action == "|":
                widget = gtk.SeparatorToolItem()
            elif action == "close":
                if bar:
                    widget = create_toolbutton(gtk.STOCK_CLOSE, self._close_cb)
                else:
                    widget = create_button("Close", self._close_cb)
            else:
                widget = self.actions.get_action(action).create_tool_item()
            if not widget:
                continue
            if bar:
                if action != "|":
                    widget.set_expand(True)
                bar.insert(widget, -1)
        if bar:
            return bar
        return widget
Exemplo n.º 14
0
    def create_bottom_buttons(self, box):
        radios = (
            ("Registers", Constants.REGISTERS),
            ("Memdump", Constants.MEMDUMP),
            ("Disasm", Constants.DISASM)
        )
        group = None
        for label, mode in radios:
            button = gtk.RadioButton(group, label)
            if not group:
                group = button
            button.connect("toggled", self.dumpmode_cb, mode)
            button.unset_flags(gtk.CAN_FOCUS)
            box.add(button)
        group.set_active(True)

        dialogs = (
            ("Memload...", self.memload_cb),
            ("Memsave...", self.memsave_cb),
            ("Options...", self.options_cb)
        )
        for label, cb in dialogs:
            button = create_button(label, cb)
            box.add(button)