예제 #1
0
def main():
    from xpra.platform import program_context
    from xpra.log import enable_color
    with program_context("GTK-Menu Info"):
        enable_color()
        log.enable_debug()
        try:
            from xpra.x11.gtk2.gdk_display_source import display  #@UnresolvedImport
            assert display
            xid = 0
            if len(sys.argv) > 1:
                wid = sys.argv[1]
                if wid.startswith("0x"):
                    xid = int(wid[2:], 16)
                else:
                    xid = int(wid)
        except Exception as e:
            log.error("Error: invalid window id: %s", e)
            log.error("usage:")
            log.error(" %s WINDOWID", sys.argv[0])
        else:
            import gtk
            from gtk import gdk

            def get_frame_extents(window):
                from xpra.x11.gtk_x11.prop import prop_get, log as x11log
                x11log.enable_debug()

                def pget(key, etype):
                    return prop_get(window,
                                    key,
                                    etype,
                                    ignore_errors=False,
                                    raise_xerrors=True)

                return pget("_NET_FRAME_EXTENTS", ["u32"])

            if xid > 0:
                #show for an existing window:
                w = gdk.window_foreign_new(xid)
                log.info("_NET_FRAME_EXTENTS=%s", get_frame_extents(w))
            else:
                #create a window an send the request:
                root = gdk.get_default_root_window()
                from xpra.gtk_common.gtk_util import WINDOW_TOPLEVEL, get_xwindow
                #code ripped from gtk_client_base:
                from xpra.gtk_common.error import xsync
                from xpra.x11.gtk_x11.send_wm import send_wm_request_frame_extents
                window = gtk.Window(WINDOW_TOPLEVEL)
                window.set_title("Xpra-FRAME_EXTENTS")
                window.connect("destroy", gtk.main_quit)
                window.realize()
                win = window.get_window()
                vbox = gtk.VBox(False, 0)
                btn = gtk.Button("request frame extents")

                def request_frame_extents(*args):
                    with xsync:
                        log("request_frame_extents() window=%#x",
                            get_xwindow(win))
                        send_wm_request_frame_extents(root, win)

                btn.connect("clicked", request_frame_extents)
                vbox.pack_start(btn, expand=False, fill=False, padding=10)
                label = gtk.Label()
                vbox.add(label)
                window.add(vbox)
                label.set_text(str(get_frame_extents(win)))
                from gi.repository import GLib

                def refresh_label():
                    v = get_frame_extents(win)
                    label.set_text(str(v))
                    log.info("_NET_FRAME_EXTENTS=%s", v)
                    return True

                window.realize()
                request_frame_extents()
                GLib.timeout_add(5000, window.show_all)
                GLib.timeout_add(1000, refresh_label)
                gtk.main()
예제 #2
0
    def unlock_tray(self, is_showing_dlg=[False]):
        try:
            from hashlib import sha1 as sha_hash
        except ImportError:
            from sha import new as sha_hash

        log.debug("Show tray lock dialog")

        if is_showing_dlg[0]:
            return
        is_showing_dlg[0] = True

        entered_pass = gtk.Entry(25)
        entered_pass.set_activates_default(True)
        entered_pass.set_width_chars(25)
        entered_pass.set_visibility(False)

        tray_lock = gtk.Dialog(title="",
                               parent=self.window.window,
                               buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                                        gtk.STOCK_OK, gtk.RESPONSE_OK))
        tray_lock.set_default_response(gtk.RESPONSE_OK)
        tray_lock.set_has_separator(False)

        tray_lock.set_border_width(5)

        hbox = gtk.HBox(spacing=5)

        image = gtk.image_new_from_file(deluge.common.get_pixmap("lock48.png"))
        image.set_alignment(0.5, 0.0)
        hbox.pack_start(image, False)

        vbox = gtk.VBox(spacing=5)
        hbox.pack_start(vbox, False)

        label = gtk.Label("<b><big>%s</big></b>" %
                          _("Deluge is password protected!"))
        label.set_use_markup(True)
        label.set_alignment(0.0, 0.5)
        label.set_line_wrap(True)
        vbox.pack_start(label, False)

        tlabel = gtk.Label("<i>%s</i>" % _("Enter your password to continue"))
        tlabel.set_use_markup(True)
        tlabel.set_alignment(0.0, 0.5)
        tlabel.set_line_wrap(True)
        vbox.pack_start(tlabel, False)

        vbox.pack_start(entered_pass)

        tray_lock.vbox.pack_start(hbox)

        def on_response(dialog, response_id):
            if response_id == gtk.RESPONSE_OK:
                if self.config["tray_password"] == sha_hash(
                        entered_pass.get_text()).hexdigest():
                    self.window.present()

            tray_lock.destroy()
            is_showing_dlg[0] = False

        tray_lock.connect("response", on_response)
        tray_lock.show_all()
예제 #3
0
## main script for testing the image + cube problem on mac, causes
## some errors because it doesn't send a demowindow to the canvas, but
## is still good enough to check whether both actors show up.

if __name__ == "__main__":

    window = gtk.Window()
    window.set_title("The Canvas 3D Test")
    window.connect("destroy", gtk.mainquit)
    window.connect("delete_event", gtk.mainquit)
    window.set_border_width(10)

    vtkda = Canvas3D(None)
    vtkda.show()

    vbox = gtk.VBox(spacing=3)
    vbox.show()
    vbox.pack_start(vtkda)

    button = gtk.Button('My Button')
    button.show()
    vbox.pack_start(button)
    window.add(vbox)

    window.set_size_request(400, 400)

    window.show()

    # The VTK stuff.
    cone = vtk.vtkConeSource()
    cone.SetResolution(80)
    def __init__(self,imageName):
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window.set_title("Tesseract Box Editor")
        self.window.connect('destroy', lambda w: gtk.main_quit())
        self.window.set_size_request(800, 600)

	self.imageName = imageName
	print self.imageName


        vbox = gtk.VBox(False, 2)
        self.window.add(vbox)
        vbox.show()

        menuBar = self.makeMenu()
        vbox.pack_start(menuBar, False)

        self.scrolledWindow = gtk.ScrolledWindow()
        self.scrolledWindow.set_policy(gtk.POLICY_AUTOMATIC,
                                       gtk.POLICY_AUTOMATIC)
        vbox.pack_start(self.scrolledWindow, True, True, 2)
        self.scrolledWindow.show()

        self.drawingArea = gtk.DrawingArea()
        self.drawingArea.connect("expose-event", self.redrawArea)
        self.scrolledWindow.add_with_viewport(self.drawingArea)
        self.drawingArea.show()

        self.textScroll = gtk.ScrolledWindow()
        self.textScroll.set_policy(gtk.POLICY_AUTOMATIC,
                                   gtk.POLICY_AUTOMATIC)
        vbox.pack_start(self.textScroll, True, True, 2)
        self.textScroll.show()

        self.textVBox = gtk.VBox()
        self.textScroll.add_with_viewport(self.textVBox)
        self.textVBox.show()

        self.buttonBox = gtk.HBox(False, 0)
        vbox.pack_start(self.buttonBox, False, False, 2)        
        self.buttonBox.show()

        b = gtk.CheckButton("_Bold", True)
        self.buttonBox.pack_start(b, False, False, 10)
        b.connect("toggled", self.onCheckButtonToggled, ATTR_BOLD)
        b.add_accelerator("activate", self.accelGroup, ord('B'),
                          gtk.gdk.CONTROL_MASK, gtk.ACCEL_VISIBLE)
        b.show()
        self.boldButton = b

        b = gtk.CheckButton("_Italic", True)
        self.buttonBox.pack_start(b, False, False, 10)
        b.connect("toggled", self.onCheckButtonToggled, ATTR_ITALIC)
        b.add_accelerator("activate", self.accelGroup, ord('I'),
                          gtk.gdk.CONTROL_MASK, gtk.ACCEL_VISIBLE)
        b.show()
        self.italicButton = b

        b = gtk.CheckButton("_Underline", True)
        self.buttonBox.pack_start(b, False, False, 10)
        b.connect("toggled", self.onCheckButtonToggled, ATTR_UNDERLINE)
        b.add_accelerator("activate", self.accelGroup, ord('U'),
                          gtk.gdk.CONTROL_MASK, gtk.ACCEL_VISIBLE)
        b.show()
        self.underlineButton = b

        self.spinBottom = gtk.SpinButton()
        self.spinBottom.connect("changed", self.onSpinButtonChanged, DIR_BOTTOM)
        self.buttonBox.pack_end(self.spinBottom, False, False, 0)
        self.spinBottom.show()
        l = gtk.Label("     Bottom:");
        self.buttonBox.pack_end(l, False, False, 0)
        l.show()

        self.spinTop = gtk.SpinButton()
        self.spinTop.connect("changed", self.onSpinButtonChanged, DIR_TOP)
        self.buttonBox.pack_end(self.spinTop, False, False, 0)
        self.spinTop.show()
        l = gtk.Label("     Top:");
        self.buttonBox.pack_end(l, False, False, 0)
        l.show()

        self.spinRight = gtk.SpinButton()
        self.spinRight.connect("changed", self.onSpinButtonChanged, DIR_RIGHT)
        self.buttonBox.pack_end(self.spinRight, False, False, 0)
        self.spinRight.show()
        l = gtk.Label("     Right:");
        self.buttonBox.pack_end(l, False, False, 0)
        l.show()

        self.spinLeft = gtk.SpinButton()
        self.spinLeft.connect("changed", self.onSpinButtonChanged, DIR_LEFT)
        self.buttonBox.pack_end(self.spinLeft, False, False, 0)
        self.spinLeft.show()
        l = gtk.Label("Left:");
        self.buttonBox.pack_end(l, False, False, 0)
        l.show()

        self.setImageControlSensitivity(False)
        self.setSymbolControlSensitivity(False)
        self.window.show()
	self.loadImageAndBoxes(None,None)
예제 #5
0
    def __init__(self):
        QTWindow.__init__(self, 'source', 'Source')

        self.connect("delete-event", self._delete_event_cb)

        self._find_string = ''
        self._find_ofs = 0

        menu = [{
            'name':
            _L('File'),
            'submenu': [{
                'name': _L('Open'),
                'action': self._open_cb,
                'accel': '<Control>o'
            }, {
                'name': _L('Close'),
                'action': self._close_cb,
                'accel': '<Control>x'
            }, {
                'name': _L('Save'),
                'action': self._save_cb,
                'accel': '<Control>s'
            }, {
                'name': _L('Save as'),
                'action': self._save_as_cb
            }, {
                'name': _L('Run'),
                'action': self._run_clicked_cb,
                'accel': '<Control>r'
            }]
        }, {
            'name':
            _L('Edit'),
            'submenu': [
                {
                    'name': _L('Find'),
                    'action': self._find_cb,
                    'accel': '<Control>f'
                },
                {
                    'name': _L('Find next'),
                    'action': self._find_next_cb,
                    'accel': '<Control>n'
                },
                {
                    'name': _L('Find previous'),
                    'action': self._find_prev_cb,
                    'accel': '<Control>p'
                },
            ]
        }]

        self._accel_group = gtk.AccelGroup()
        self.add_accel_group(self._accel_group)
        self._menu = gui.build_menu(menu, accelgroup=self._accel_group)

        # Run menu
        self._name = gtk.Entry()
        self._run_button = gtk.Button(_L('Run'))
        self._run_button.connect('clicked', self._run_clicked_cb)

        self._options = gui.pack_hbox(
            [gtk.Label(_L('Name')), self._name, self._run_button])

        # Directory and edit panes
        self._file_info = {}
        self._notebook = gtk.Notebook()

        self._dir_pane = DirPane()
        self._dir_pane.dir_browser.connect('file-activated',
                                           self._file_activated_cb)

        self._panes = gtk.HPaned()
        self._panes.add1(self._dir_pane)
        self._panes.add2(self._notebook)

        # Put everything together
        self._vbox = gtk.VBox()
        self._vbox.pack_start(self._menu, False, False)
        self._vbox.pack_start(self._options, False, False)
        self._vbox.pack_start(self._panes, True, True)
        self.add(self._vbox)

        self._vbox.show_all()
 def __create_widget(self):
     '''create gtk widget'''
     title_item_font_size = TITLE_FONT_SIZE
     option_item_font_size = CONTENT_FONT_SIZE
     # image init
     self.image_widgets["custom"] = ImageBox(app_theme.get_pixbuf("%s/mouse_l.png" % MODULE_NAME))
     self.image_widgets["speed"] = ImageBox(app_theme.get_pixbuf("%s/pointer.png" % MODULE_NAME))
     self.image_widgets["double"] = ImageBox(app_theme.get_pixbuf("%s/double-click.png" % MODULE_NAME))
     self.image_widgets["double_test_1"] = app_theme.get_pixbuf("%s/smiley00.png" % MODULE_NAME)
     self.image_widgets["double_test_2"] = app_theme.get_pixbuf("%s/smiley01.png" % MODULE_NAME)
     # label init
     self.label_widgets["custom"] = Label(_("Custom"), app_theme.get_color("globalTitleForeground"), text_size=title_item_font_size, enable_select=False, enable_double_click=False)
     self.label_widgets["pointer_speed"] = Label(_("Pointer Speed"), app_theme.get_color("globalTitleForeground"), text_size=title_item_font_size, enable_select=False, enable_double_click=False)
     self.label_widgets["acceleration"] = Label(_("Acceleration"), text_size=option_item_font_size,
                                                text_x_align=ALIGN_END, enable_select=False,
                                                enable_double_click=False, fixed_width=STANDARD_LINE)
     self.label_widgets["accel_fast"] = Label(_("Fast"), enable_select=False, enable_double_click=False)
     self.label_widgets["accel_slow"] = Label(_("Slow"), enable_select=False, enable_double_click=False)
     self.label_widgets["sensitivity"] = Label(_("Sensitivity"), text_size=option_item_font_size,
                                               text_x_align=ALIGN_END, enable_select=False,
                                               enable_double_click=False, fixed_width=STANDARD_LINE)
     self.label_widgets["sensitiv_low"] = Label(_("Low"), enable_select=False, enable_double_click=False)
     self.label_widgets["sensitiv_high"] = Label(_("High"), enable_select=False, enable_double_click=False)
     self.label_widgets["double_click"] = Label(_("Double-click"), app_theme.get_color("globalTitleForeground"), text_size=title_item_font_size, enable_select=False, enable_double_click=False)
     self.label_widgets["click_rate"] = Label(_("Frequency"), text_size=option_item_font_size,
                                              text_x_align=ALIGN_END, enable_select=False,
                                              enable_double_click=False, fixed_width=STANDARD_LINE)
     self.label_widgets["click_fast"] = Label(_("Fast"), enable_select=False, enable_double_click=False)
     self.label_widgets["click_slow"] = Label(_("Slow"), enable_select=False, enable_double_click=False)
     self.label_widgets["double_test"] = Label(_("Double-click on the smiley face to test your settings."),
         label_width=HSCALEBAR_WIDTH, wrap_width=HSCALEBAR_WIDTH, enable_select=False, enable_double_click=False)
     self.label_widgets["relevant"] = Label(_("Relevant Settings"), text_size=title_item_font_size,
                                            enable_select=False, enable_double_click=False, fixed_width=180)
     # button init
     self.button_widgets["right_hand_radio"] = RadioButton( _("Right-handed"), padding_x=10)
     self.button_widgets["left_hand_radio"] = RadioButton(_("Left-handed"), padding_x=10)
     self.button_widgets["double_test"] = gtk.EventBox()
     # relevant settings button
     self.button_widgets["keyboard_setting"] = Label("<u>%s</u>" % _("Keyboard Settings"),
         DynamicColor(GOTO_FG_COLOR), text_size=option_item_font_size,
         enable_select=False, enable_double_click=False, fixed_width=180)
     self.button_widgets["touchpad_setting"] = Label("<u>%s</u>" % _("TouchPad Settings"),
         DynamicColor(GOTO_FG_COLOR), text_size=option_item_font_size,
         enable_select=False, enable_double_click=False, fixed_width=180)
     self.button_widgets["set_to_default"] = Button(_("Reset"))
     # container init
     self.container_widgets["main_vbox"] = gtk.VBox(False)
     self.container_widgets["statusbar"] = StatusBar()
     self.container_widgets["main_hbox"] = gtk.HBox(False)
     self.container_widgets["left_vbox"] = gtk.VBox(False)
     self.container_widgets["right_vbox"] = gtk.VBox(False)
     self.container_widgets["custom_main_vbox"] = gtk.VBox(False)            # custom
     self.container_widgets["custom_label_hbox"] = gtk.HBox(False)
     self.container_widgets["custom_button_hbox"] = gtk.HBox(False)
     self.container_widgets["pointer_speed_main_vbox"] = gtk.VBox(False)     # pointer speed
     self.container_widgets["pointer_speed_label_hbox"] = gtk.HBox(False)
     self.container_widgets["pointer_speed_table"] = gtk.Table(2, 4, False)
     self.container_widgets["pointer_speed_accel_hbox"] = gtk.HBox(False)
     self.container_widgets["pointer_speed_sensitiv_hbox"] = gtk.HBox(False)
     self.container_widgets["double_click_main_vbox"] = gtk.VBox(False)      # double click
     self.container_widgets["double_click_label_hbox"] = gtk.HBox(False)
     self.container_widgets["double_click_table"] = gtk.Table(2, 4, False)
     self.container_widgets["double_click_rate_hbox"] = gtk.HBox(False)
     # alignment init
     self.alignment_widgets["main_hbox"] = gtk.Alignment()
     self.alignment_widgets["left"] = gtk.Alignment()
     self.alignment_widgets["right"] = gtk.Alignment()
     self.alignment_widgets["custom_label"] = gtk.Alignment()            # custom
     self.alignment_widgets["custom_button"] = gtk.Alignment()
     self.alignment_widgets["pointer_speed_label"] = gtk.Alignment()     # pointer speed
     self.alignment_widgets["pointer_speed_table"] = gtk.Alignment()
     self.alignment_widgets["double_click_label"] = gtk.Alignment()      # double click
     self.alignment_widgets["double_click_table"] = gtk.Alignment()
     self.alignment_widgets["keyboard_setting"] = gtk.Alignment()
     self.alignment_widgets["touchpad_setting"] = gtk.Alignment()
     # adjust init
     self.adjust_widgets["pointer_speed_accel"] = gtk.Adjustment(1.0, 1.0, 10.0, 1, 2)
     self.adjust_widgets["pointer_speed_sensitiv"] = gtk.Adjustment(1, 1, 10, 1, 2)
     self.adjust_widgets["double_click_rate"] = gtk.Adjustment(100, 100, 1000, 100, 200)
     # scale init
     self.scale_widgets["pointer_speed_accel"] = HScalebar(value_min=1, value_max=10)
     #self.scale_widgets["pointer_speed_accel"] = HScalebar(
         #None, None, None, None, None, None,
         #app_theme.get_pixbuf("scalebar/point.png"))
     #self.scale_widgets["pointer_speed_accel"].set_adjustment( self.adjust_widgets["pointer_speed_accel"])
     self.scale_widgets["pointer_speed_sensitiv"] = HScalebar(value_min=1, value_max=10)
     #self.scale_widgets["pointer_speed_sensitiv"] = HScalebar(
         #None, None, None, None, None, None,
         #app_theme.get_pixbuf("scalebar/point.png"))
     #self.scale_widgets["pointer_speed_sensitiv"].set_adjustment( self.adjust_widgets["pointer_speed_sensitiv"])
     self.scale_widgets["double_click_rate"] = HScalebar(value_min=100, value_max=1000)
예제 #7
0
    def __init__(self, wallet, config):
        self.config = config
        self.wallet = wallet
        self.funds_error = False  # True if not enough funds

        self.window = MyWindow(gtk.WINDOW_TOPLEVEL)
        title = 'Electrum ' + self.wallet.electrum_version + '  -  ' + self.config.path
        if not self.wallet.seed: title += ' [seedless]'
        self.window.set_title(title)
        self.window.connect("destroy", gtk.main_quit)
        self.window.set_border_width(0)
        self.window.connect('mykeypress', gtk.main_quit)
        self.window.set_default_size(720, 350)
        self.wallet_updated = False

        vbox = gtk.VBox()

        self.notebook = gtk.Notebook()
        self.create_history_tab()
        if self.wallet.seed:
            self.create_send_tab()
        self.create_recv_tab()
        self.create_book_tab()
        self.create_about_tab()
        self.notebook.show()
        vbox.pack_start(self.notebook, True, True, 2)

        self.status_bar = gtk.Statusbar()
        vbox.pack_start(self.status_bar, False, False, 0)

        self.status_image = gtk.Image()
        self.status_image.set_from_stock(gtk.STOCK_NO, gtk.ICON_SIZE_MENU)
        self.status_image.set_alignment(True, 0.5)
        self.status_image.show()

        self.network_button = gtk.Button()
        self.network_button.connect(
            "clicked", lambda x: run_network_dialog(self.wallet, self.window))
        self.network_button.add(self.status_image)
        self.network_button.set_relief(gtk.RELIEF_NONE)
        self.network_button.show()
        self.status_bar.pack_end(self.network_button, False, False)

        if self.wallet.seed:

            def seedb(w, wallet):
                if wallet.use_encryption:
                    password = password_dialog(self.window)
                    if not password: return
                else: password = None
                show_seed_dialog(wallet, password, self.window)

            button = gtk.Button('S')
            button.connect("clicked", seedb, wallet)
            button.set_relief(gtk.RELIEF_NONE)
            button.show()
            self.status_bar.pack_end(button, False, False)

        settings_icon = gtk.Image()
        settings_icon.set_from_stock(gtk.STOCK_PREFERENCES, gtk.ICON_SIZE_MENU)
        settings_icon.set_alignment(0.5, 0.5)
        settings_icon.set_size_request(16, 16)
        settings_icon.show()

        prefs_button = gtk.Button()
        prefs_button.connect(
            "clicked", lambda x: run_settings_dialog(self.wallet, self.window))
        prefs_button.add(settings_icon)
        prefs_button.set_tooltip_text("Settings")
        prefs_button.set_relief(gtk.RELIEF_NONE)
        prefs_button.show()
        self.status_bar.pack_end(prefs_button, False, False)

        pw_icon = gtk.Image()
        pw_icon.set_from_stock(gtk.STOCK_DIALOG_AUTHENTICATION,
                               gtk.ICON_SIZE_MENU)
        pw_icon.set_alignment(0.5, 0.5)
        pw_icon.set_size_request(16, 16)
        pw_icon.show()

        if self.wallet.seed:
            password_button = gtk.Button()
            password_button.connect(
                "clicked", lambda x: change_password_dialog(
                    self.wallet, self.window, pw_icon))
            password_button.add(pw_icon)
            password_button.set_relief(gtk.RELIEF_NONE)
            password_button.show()
            self.status_bar.pack_end(password_button, False, False)

        self.window.add(vbox)
        self.window.show_all()
        #self.fee_box.hide()

        self.context_id = self.status_bar.get_context_id("statusbar")
        self.update_status_bar()

        self.wallet.interface.register_callback('updated',
                                                self.update_callback)

        def update_status_bar_thread():
            while True:
                gobject.idle_add(self.update_status_bar)
                time.sleep(0.5)

        def check_recipient_thread():
            old_r = ''
            while True:
                time.sleep(0.5)
                if self.payto_entry.is_focus():
                    continue
                r = self.payto_entry.get_text()
                if r != old_r:
                    old_r = r
                    r = r.strip()
                    if re.match('^(|([\w\-\.]+)@)((\w[\w\-]+\.)+[\w\-]+)$', r):
                        try:
                            to_address = self.wallet.get_alias(
                                r, interactive=False)
                        except:
                            continue
                        if to_address:
                            s = r + ' <' + to_address + '>'
                            gobject.idle_add(
                                lambda: self.payto_entry.set_text(s))

        thread.start_new_thread(update_status_bar_thread, ())
        if self.wallet.seed:
            thread.start_new_thread(check_recipient_thread, ())
        self.notebook.set_current_page(0)
예제 #8
0
    def __init__(self, opts):
        gtk.Window.__init__(self)
        self.connect("delete-event", self._cleanup)
        self.set_title("{0} {1}".format(name, version))

        self.cfg = opts
        self.serverwrangler = ServerWrangler(self.cfg, self._do_log)
        self.serverwrangler.connect("upnp-error", self._do_upnp_error)
        self.current_server = None

        self.bound_actions = gtk.ActionGroup("bound_actions")

        vbox = gtk.VBox()
        self.add(vbox)

        # Actions

        add_server_action = gtk.Action("add_server", "Create Server",
                                       "Create a new DHT Server.",
                                       gtk.STOCK_NEW)
        add_server_action.connect("activate", self.add_server)

        add_multiple_servers_action = gtk.Action(
            "add_multiple_servers", "Create Multiple Servers",
            "Create Multiple DHT Servers.", gtk.STOCK_NEW)
        add_multiple_servers_action.connect("activate",
                                            self.add_multiple_servers)

        quit_action = gtk.Action("quit", "Quit", "Quit", gtk.STOCK_QUIT)
        quit_action.connect("activate", self.quit)

        ping_action = gtk.Action("ping", "Ping Node...", "Ping a DHT Node",
                                 gtk.STOCK_REFRESH)
        ping_action.connect("activate", self.ping_node)
        self.bound_actions.add_action(ping_action)

        find_action = gtk.Action("find", "Find Node...", "Find a DHT Node",
                                 gtk.STOCK_FIND)
        find_action.connect("activate", self.find_node)
        self.bound_actions.add_action(find_action)

        get_peers_action = gtk.Action("get_peers", "Get Peers...",
                                      "Get DHT Peers", gtk.STOCK_FIND)
        get_peers_action.connect("activate", self.get_peers)
        self.bound_actions.add_action(get_peers_action)

        load_action = gtk.Action("load", "Load From Torrent...",
                                 "Load DHT Nodes from a torrent file",
                                 gtk.STOCK_OPEN)
        load_action.connect("activate", self.load_torrent)
        self.bound_actions.add_action(load_action)

        # Menus

        menubar = gtk.MenuBar()
        vbox.pack_start(menubar, False, False)

        file_menuitem = gtk.MenuItem("File")
        menubar.add(file_menuitem)

        file_menu = gtk.Menu()
        file_menuitem.set_submenu(file_menu)

        file_menu.add(add_server_action.create_menu_item())
        file_menu.add(add_multiple_servers_action.create_menu_item())
        file_menu.add(gtk.SeparatorMenuItem())
        file_menu.add(quit_action.create_menu_item())

        tools_menuitem = gtk.MenuItem("Tools")
        menubar.add(tools_menuitem)

        tools_menu = gtk.Menu()
        tools_menuitem.set_submenu(tools_menu)

        tools_menu.add(ping_action.create_menu_item())
        tools_menu.add(find_action.create_menu_item())
        tools_menu.add(get_peers_action.create_menu_item())
        tools_menu.add(load_action.create_menu_item())

        # Main Toolbar

        toolbar = gtk.Toolbar()
        vbox.pack_start(toolbar, False, False)

        toolbar.add(add_server_action.create_tool_item())
        toolbar.add(add_multiple_servers_action.create_tool_item())

        # Work area

        serverpane = gtk.HPaned()
        vbox.pack_start(serverpane, True, True)

        self.serverview = dbview.ServerView(self.serverwrangler)
        self.serverview.connect("cursor-changed",
                                self._do_serverview_cursor_changed)
        serverpane.pack1(self.serverview, True, True)

        server_frame = gtk.Frame()
        server_frame.set_shadow_type(gtk.SHADOW_IN)
        serverpane.pack2(server_frame, True, True)

        server_area = gtk.VBox()
        server_frame.add(server_area)

        # Server Area

        server_toolbar = gtk.Toolbar()
        server_area.pack_start(server_toolbar, False, False)

        server_toolbar.add(ping_action.create_tool_item())
        server_toolbar.add(find_action.create_tool_item())
        server_toolbar.add(get_peers_action.create_tool_item())
        server_toolbar.add(load_action.create_tool_item())

        self.notebook = gtk.Notebook()
        server_area.pack_start(self.notebook)

        self.bucketview = dbview.BucketView()

        self.nodeview = dbview.NodeView(self.bucketview)
        self.nodeview.connect("right-click", self._do_nodeview_right_click)

        self.peerview = dbview.PeerView()

        self.torrentview = dbview.TorrentView()
        self.torrentview.connect("right-click",
                                 self._do_torrentview_right_click)

        self.bucketnodeview = dbview.BucketNodeView(self.bucketview,
                                                    self.nodeview)
        self.bucketnodeview.connect("right-click",
                                    self._do_nodeview_right_click)

        self.torrentpeerview = dbview.TorrentPeerView(self.torrentview,
                                                      self.peerview)
        self.peertorrentview = dbview.PeerTorrentView(self.peerview,
                                                      self.torrentview)
        self.peertorrentview.connect("right-click",
                                     self._do_torrentview_right_click)

        self.notebook.append_page(self.nodeview, gtk.Label("Nodes"))

        bucketspane = gtk.VPaned()
        self.notebook.append_page(bucketspane, gtk.Label("Buckets"))

        bucketspane.pack1(self.bucketview, True, True)
        bucketspane.pack2(self.bucketnodeview, True, True)

        torrentspane = gtk.VPaned()
        self.notebook.append_page(torrentspane, gtk.Label("Torrents"))

        torrentspane.pack1(self.torrentview, True, True)
        torrentspane.pack2(self.torrentpeerview, True, True)

        peerspane = gtk.VPaned()
        self.notebook.append_page(peerspane, gtk.Label("Peers"))

        peerspane.pack1(self.peerview, True, True)
        peerspane.pack2(self.peertorrentview, True, True)

        logwin = gtk.ScrolledWindow()
        logwin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        self.notebook.append_page(logwin, gtk.Label("Log"))

        self.logbuffer = gtk.TextBuffer()
        self.logview = gtk.TextView(self.logbuffer)
        self.logview.set_wrap_mode(gtk.WRAP_NONE)
        self.logview.set_editable(True)
        self.logview.set_cursor_visible(False)
        logwin.add(self.logview)

        # Status Bar

        self.statusbar = gtk.Statusbar()
        vbox.pack_end(self.statusbar, False, False)

        #    self.serverstatus = StatusLabel("Server:", False)
        #    self.statusbar.pack_start(self.serverstatus, False, False)

        #    self.statusbar.pack_start(gtk.VSeparator(), False, False)

        self.netstatus = StatusLabel("Network:")
        self.netstatus.attach_to_prop(self.serverwrangler, "incoming")
        self.statusbar.pack_start(self.netstatus, False, False)

        self.bound_actions.set_sensitive(False)

        self.show_all()
        self.hide()

        self.serverwrangler.launch_dispatch()

        self._do_log("Application Initiated.")
예제 #9
0
	def __init__(self):
		#gtk entry
		self.entry1 = gtk.Entry()
		self.entry2 = gtk.Entry()
		self.entry3 = gtk.Entry()
		self.entry4 = gtk.Entry()
		self.entry5 = gtk.Entry()
		
		#gtk label
		self.out1 = gtk.Label()
		self.out2 = gtk.Label()
		self.out3 = gtk.Label()
		self.out4 = gtk.Label()
		self.out5 = gtk.Label()
		self.out6 = gtk.Label()
		self.out7 = gtk.Label()
		self.out8 = gtk.Label()
		self.out9 = gtk.Label()
		self.out10 = gtk.Label()
		self.out11 = gtk.Label()
		self.out12 = gtk.Label()
		
		labelA = gtk.Label('')
		labelA.set_markup( _('<b>PENDAPATAN</b>'))
		labelB = gtk.Label('')
		labelB.set_markup( _('<b>ZAKAT PENGHASILAN</b>'))
		labelC = gtk.Label('')
		labelC.set_markup( _('<b>ZAKAT SIMPANAN</b>'))
		
		label1 = gtk.Label( _("Pendapatan atau gaji (per bulan)"))
		label2 = gtk.Label( _("Pendapatan lain (per bulan)"))
		label3 = gtk.Label( _("Pendapatan total (per tahun)"))
		label4 = gtk.Label( _("Kebutuhan (per bulan)"))
		label5 = gtk.Label( _("Kebutuhan total (per tahun)"))
		label6 = gtk.Label( _("Sisa pendapatan"))
		
		label7 = gtk.Label( _("Harga beras saat ini (per kg)"))
		label8 = gtk.Label( _("Besarnya nishab"))
		label9 = gtk.Label( _("Wajib zakat penghasilan?"))
		label10 = gtk.Label( _("Besarnya zakat penghasilan yang harus dibayarkan"))
		label11 = gtk.Label( _("Zakat per tahun"))
		label12 = gtk.Label( _("Zakat per bulan"))
		
		label13 = gtk.Label( _("Harga emas saat ini (per gram)"))
		label14 = gtk.Label( _("Besarnya nishab"))
		label15 = gtk.Label( _("Wajib zakat simpanan?"))
		label16 = gtk.Label( _("Besarnya zakat simpanan yang harus dibayarkan"))
		label17 = gtk.Label( _("Zakat per tahun"))
		label18 = gtk.Label( _("Zakat per bulan"))
					
		#gtk button
		button1 = gtk.Button( _("_Ihwal"), stock='gtk-about')
		button2 = gtk.Button( _("_Hitung Zakat"))
		button3 = gtk.Button( _("_Bersihkan"), stock='gtk-clear')
		button4 = gtk.Button( _("_Tutup"), stock='gtk-close')
		
		#vbox
		vbox1 = gtk.VBox(False, 5)
		vbox2 = gtk.VBox(False, 5)
		
		#buttonbox
		buttonbox = gtk.HButtonBox()
		buttonbox.set_spacing(15)
		buttonbox.set_layout(gtk.BUTTONBOX_CENTER)
						
		buttonbox.add(button1)
		buttonbox.add(button2)
		buttonbox.add(button3)
		buttonbox.add(button4)
		
		#image
		pixbuf = gtk.gdk.pixbuf_new_from_file("/usr/share/zacalc/image/logo.png")
		image = gtk.Image()
		image.set_from_pixbuf(pixbuf)
		image.show()
		
		#table
		table1 = gtk.Table(1,6,True)
		table2 = gtk.Table(1,6,True)
			
		#frame
		frame = gtk.Frame()
		frame.set_shadow_type(gtk.SHADOW_ETCHED_IN)
								
		#align
		align1 = gtk.Alignment(0.5, 0.3, 0, 0)
		align2 = gtk.Alignment(0.5, 0.1, 0, 0)
		align3 = gtk.Alignment(0.5, 0.5, 0, 0)
		
		#layout inserting
		vbox1.add(frame)
		vbox1.add(buttonbox)
		
		frame.add(align1)
		align1.add(table1)
		align3.add(vbox2)
		align2.add(table2)
		
		table1.attach(image,3,6,0,10)
		
		table1.attach(labelA,0,3,0,1)
		
		table1.attach(label1,0,2,1,2)
		table1.attach(label2,0,2,2,3)
		table1.attach(label3,0,2,3,4)
		table1.attach(label4,0,2,4,5)
		table1.attach(label5,0,2,5,6)
		table1.attach(label6,0,2,6,7)
		
		table1.attach(self.entry1,2,3,1,2)
		table1.attach(self.entry2,2,3,2,3)
		table1.attach(self.out1,2,3,3,4)
		table1.attach(self.entry3,2,3,4,5)
		table1.attach(self.out2,2,3,5,6)
		table1.attach(self.out3,2,3,6,7)
		
		table1.attach(labelB,0,3,8,9)
		
		table1.attach(label7,0,2,9,10)
		table1.attach(label8,0,2,10,11)
		table1.attach(label9,0,2,11,12)
		table1.attach(label10,0,3,12,13)
		
		table1.attach(self.entry4,2,3,9,10)
		table1.attach(self.out4,2,3,10,11)
		table1.attach(self.out5,2,3,11,12)
		
		table1.attach(label11,0,2,13,14)
		table1.attach(label12,0,2,14,15)
		
		table1.attach(self.out6,2,3,13,14)
		table1.attach(self.out7,2,3,14,15)
		
		table1.attach(labelC,3,5,8,9)
		
		table1.attach(label13,3,5,9,10)
		table1.attach(label14,3,5,10,11)
		table1.attach(label15,3,5,11,12)
		table1.attach(label16,3,6,12,13)
		
		table1.attach(self.entry5,5,6,9,10)
		table1.attach(self.out8,5,6,10,11)
		table1.attach(self.out9,5,6,11,12)
	
		table1.attach(label17,3,5,13,14)
		table1.attach(label18,3,5,14,15)
		
		table1.attach(self.out10,5,6,13,14)
		table1.attach(self.out11,5,6,14,15)
			
		#property
		frame.set_label('')
						
		self.clear_value(self)

		self.out1.set_alignment(xalign=0.95, yalign=0.5)
		self.out2.set_alignment(xalign=0.95, yalign=0.5)
		self.out3.set_alignment(xalign=0.95, yalign=0.5)
		self.out4.set_alignment(xalign=0.95, yalign=0.5)
		self.out5.set_alignment(xalign=0.05, yalign=0.5)
		self.out6.set_alignment(xalign=0.95, yalign=0.5)
		self.out7.set_alignment(xalign=0.95, yalign=0.5)
		self.out8.set_alignment(xalign=0.95, yalign=0.5)
		self.out9.set_alignment(xalign=0.05, yalign=0.5)
		self.out10.set_alignment(xalign=0.95, yalign=0.5)
		self.out11.set_alignment(xalign=0.95, yalign=0.5)
				
		labelA.set_alignment(xalign=0, yalign=0.5)
		labelB.set_alignment(xalign=0, yalign=0.5)
		labelC.set_alignment(xalign=0, yalign=0.5)
		
		label1.set_alignment(xalign=0, yalign=0.5)
		label2.set_alignment(xalign=0, yalign=0.5)
		label3.set_alignment(xalign=0, yalign=0.5)
		label4.set_alignment(xalign=0, yalign=0.5)
		label5.set_alignment(xalign=0, yalign=0.5)
		label6.set_alignment(xalign=0, yalign=0.5)
		label7.set_alignment(xalign=0, yalign=0.5)
		label8.set_alignment(xalign=0, yalign=0.5)
		label9.set_alignment(xalign=0, yalign=0.5)
		label10.set_alignment(xalign=0, yalign=0.5)
		label11.set_alignment(xalign=0, yalign=0.5)
		label12.set_alignment(xalign=0, yalign=0.5)
		label13.set_alignment(xalign=0, yalign=0.5)
		label14.set_alignment(xalign=0, yalign=0.5)
		label15.set_alignment(xalign=0, yalign=0.5)
		label16.set_alignment(xalign=0, yalign=0.5)
		label17.set_alignment(xalign=-0, yalign=0.5)
		label18.set_alignment(xalign=-0, yalign=0.5)
		image.set_alignment(xalign=0, yalign=0.5)
		
		table1.set_col_spacings(30)			
		align1.set_padding(5, 5, 15, 15)
		table2.set_col_spacings(0)			
		align2.set_padding(0, 0, 0, 0)
		
		#signal
		self.entry1.connect("changed",  self.valid_number)
		self.entry2.connect("changed",  self.valid_number)
		self.entry3.connect("changed",  self.valid_number)
		self.entry4.connect("changed",  self.valid_number)
		self.entry5.connect("changed",  self.valid_number)
		
		button1.connect("clicked",  self.show_about)
		button2.connect("clicked",  self.calculate)
		button3.connect("clicked",  self.clear_value)
		button4.connect("clicked",  gtk.main_quit)
		
		icon_theme = gtk.icon_theme_get_default()
		try:
			self.icon = icon_theme.load_icon("zacalc", 48, 0)
		except Exception, e:
			print "can't load icon", e
예제 #10
0
    	def __init__(self):
		file_name_entry = gtk.Entry(max=256)
        	# create a new window
        	window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        	#window.set_size_request(800, 600)
        	window.set_title("Story Board")
        	window.connect("delete_event", lambda w,e: gtk.main_quit())

        	vbox = gtk.VBox(False, 0)
        	window.add(vbox)
        	vbox.show()
		
		# Menu
		file_menu = gtk.Menu();
		open_menu_item = gtk.MenuItem("Open")
		file_menu.append(open_menu_item)
		open_menu_item.connect("activate", self.file_dialog, file_name_entry)
		open_menu_item.show()
		quit_menu_item = gtk.MenuItem("Quit")
		file_menu.append(quit_menu_item)
		quit_menu_item.connect("activate", lambda w,e: gtk.main_quit(), "Quit")
		quit_menu_item.show()
		file_root_menu = gtk.MenuItem("File")
		file_root_menu.show()
		file_root_menu.set_submenu(file_menu)

		menubar = gtk.MenuBar()
		vbox.pack_start(menubar, False, False, 0)
		menubar.show()
		menubar.append(file_root_menu)
	
		# Port name
		hbox = gtk.HBox(False, 0)
		vbox.pack_start(hbox)
		hbox.show()
		port_label = gtk.Label("Port name:")
		hbox.pack_start(port_label, False, False, 5)
		port_label.show()

        	port_name_entry = gtk.Entry()
        	port_name_entry.set_max_length(50)
        	port_name_entry.connect("activate", self.enter_callback, port_name_entry)
        	#port_name = port_name_entry.get_text()
        	hbox.pack_start(port_name_entry, False, False, 0)
	        port_name_entry.show()

		hbox_filename = gtk.HBox(False, 0)
		vbox.pack_start(hbox_filename)
		hbox_filename.show()
		file_name_label = gtk.Label("File name:")
		hbox_filename.pack_start(file_name_label, False, False, 0)
		file_name_label.show()

		hbox_filename.pack_start(file_name_entry, True, True, 0)
		file_name_entry.show()

        	hbox2 = gtk.HBox(False, 0)
        	vbox.add(hbox2)
        	hbox2.show()
        
		# Function
		function_label = gtk.Label("Function:")
        	hbox2.pack_start(function_label, False, False, 5)
        	function_label.show()

        	function_button = gtk.RadioButton(None, "Add")        
        	hbox2.pack_start(function_button, False, False, 0)
        	function_button.show()
    
        	function_button = gtk.RadioButton(function_button, "Delete")
        	hbox2.pack_start(function_button, False, False, 0)
        	function_button.show()
        
        	hbox3 = gtk.HBox(False, 0)
        	vbox.add(hbox3)
        	hbox3.show()
        
		# Buttons
        	ok_button = gtk.Button(stock=gtk.STOCK_OK)
		ok_button.connect("clicked", self.ok_button_callback, file_name_entry, port_name_entry)
        	hbox3.pack_start(ok_button, False, False, 0)
        	ok_button.show()
                                   
        	close_button = gtk.Button(stock=gtk.STOCK_CLOSE)
        	close_button.connect("clicked", lambda w: gtk.main_quit())
        	hbox3.pack_start(close_button, False, False, 0)
        	close_button.set_flags(gtk.CAN_DEFAULT)
        	close_button.grab_default()
        	close_button.show()
        	window.show()
예제 #11
0
파일: form.py 프로젝트: tarun-kmr/tryton
 def __init__(self, col=1, homogeneous=False):
     self.col = 1
     self.table = gtk.VBox()
     self.table.set_homogeneous(homogeneous)
예제 #12
0
    def __init__(self):
        global stuff_box

        # create a new window
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window.connect("delete_event", self.delete_event)
        self.window.connect("destroy", self.destroy)

        # Sets the border width of the window.
        self.window.set_border_width(15)

        main_box = gtk.VBox()
        self.options_box = gtk.HBox()
        control_box = gtk.VBox()
        stuff_box = gtk.HBox()

        self.window.set_title("Remote Controller")

        #option field:
        self.options_box.lights = gtk.CheckButton("Lights")
        self.options_box.logging = gtk.CheckButton("Logging")
        self.options_box.debug = gtk.CheckButton("Debug")

        self.options_box.remote_ip = gtk.HBox()
        self.options_box.remote_ip.entry = gtk.Entry(15)
        self.options_box.remote_ip.entry.set_text("192.168.2.11")
        self.options_box.remote_ip.connect_button = gtk.Button(" Connect  ")
        self.options_box.remote_ip.pack_start(self.options_box.remote_ip.entry,
                                              False, False, 13)
        self.options_box.remote_ip.pack_start(
            self.options_box.remote_ip.connect_button, False, False, 3)

        #connect option buttons
        self.options_box.lights.connect("toggled", self.options_handler,
                                        "lights")
        self.options_box.logging.connect("toggled", self.options_handler,
                                         "logging")
        self.options_box.debug.connect("toggled", self.options_handler,
                                       "debug")
        self.options_box.remote_ip.connect_button.connect(
            "clicked", self.options_handler, "connect_button")

        #Control Frame:
        control_frame = gtk.Frame()
        control_frame.set_label("Controlling")
        control_frame.add(control_box)

        control_box.sides = gtk.HBox()
        control_box.up_box = gtk.HBox()
        control_box.down_box = gtk.HBox()

        control_box.up = create_arrow_button(gtk.ARROW_UP, gtk.SHADOW_IN,
                                             "Forwards")
        control_box.left = create_arrow_button(gtk.ARROW_LEFT, gtk.SHADOW_IN,
                                               "Left")
        control_box.right = create_arrow_button(gtk.ARROW_RIGHT, gtk.SHADOW_IN,
                                                "Right")
        control_box.down = create_arrow_button(gtk.ARROW_DOWN, gtk.SHADOW_IN,
                                               "Backwards")

        control_box.sides.pack_start(control_box.left, True, False, 20)
        control_box.sides.pack_start(control_box.right, True, False, 20)
        control_box.up_box.pack_start(control_box.up, True, False, 13)
        control_box.down_box.pack_start(control_box.down, True, False, 13)

        #connect controlling buttons
        control_box.up.connect("released", self.released_handler, "forward")
        control_box.down.connect("released", self.released_handler, "backward")
        control_box.left.connect("released", self.released_handler, "left")
        control_box.right.connect("released", self.released_handler, "right")

        control_box.up.connect("pressed", self.pressed_handler, "forward")
        control_box.down.connect("pressed", self.pressed_handler, "backward")
        control_box.left.connect("pressed", self.pressed_handler, "left")
        control_box.right.connect("pressed", self.pressed_handler, "right")

        self.window.connect("key-press-event", self.click_event)
        self.window.connect("key-release-event", self.click_event)

        #Singals and Infos about the car
        stuff_box.battery = gtk.ProgressBar()
        stuff_box.battery.set_text("Battery")
        stuff_box.sig_strength = gtk.ProgressBar()
        stuff_box.sig_strength.set_text("Signal strength")
        stuff_box.speed = gtk.Label("N/A Km/h")
        stuff_box.temp = gtk.Label("N/A Degrees C.")

        #add the widgets to the boxes
        self.options_box.pack_start(self.options_box.lights, False, False, 3)
        self.options_box.pack_start(self.options_box.logging, False, False, 3)
        self.options_box.pack_start(self.options_box.debug, False, False, 3)
        self.options_box.pack_start(self.options_box.remote_ip, False, False,
                                    3)

        control_box.pack_start(control_box.up_box, True, False, 3)
        control_box.pack_start(control_box.sides, True, False, 3)
        control_box.pack_start(control_box.down_box, True, False, 3)

        stuff_box.pack_start(stuff_box.battery, False, False, 3)
        stuff_box.pack_start(stuff_box.sig_strength, False, False, 3)
        stuff_box.pack_start(stuff_box.speed, False, False, 3)
        stuff_box.pack_start(stuff_box.temp, False, False, 3)

        #add the boxes to the main_box
        main_box.pack_start(self.options_box, True, False, 13)
        main_box.pack_start(control_frame, True, True, 13)
        main_box.pack_start(stuff_box, True, False, 13)

        #add the main_box to the window
        self.window.add(main_box)

        # The final step is to display all widgets.
        self.window.show_all()

        #do some initializations
        self.car = communication()
        init_stats()
예제 #13
0
파일: gtk8.py 프로젝트: vzkrish/Python
# add items to the menu bar by creating item objects
m1 = gtk.MenuItem("File")
n1 = gtk.Menu()
m1.set_submenu(n1)
add = gtk.MenuItem("Add")
add.connect('activate', display)
n1.append(add)
dele = gtk.MenuItem("Del")
dele.connect('activate', output)
n1.append(dele)
exit = gtk.MenuItem("Exit")
exit.connect('activate', gtk.main_quit)
n1.append(exit)

m2 = gtk.MenuItem("Edit")
m3 = gtk.MenuItem("Print")

# append the menu items to the menu bar
m.append(m1)
m.append(m2)
m.append(m3)

# layout management
vbox = gtk.VBox(False, 2)
vbox.pack_start(m, False, False, 0)
x.add(vbox)
x.connect("destroy", gtk.main_quit)
x.show_all()
gtk.main()
예제 #14
0
  def init(self):

      # The user_id to work on
      self.current_user_id = 0
      self.user_list = []

      # ---------------
      # Log Management
      # ---------------

      # create tree model
      self.log_model = gtk.ListStore(
          gobject.TYPE_STRING,
          gobject.TYPE_STRING,
          gobject.TYPE_STRING,
          gobject.TYPE_INT,
          gobject.TYPE_INT,
          gobject.TYPE_INT,
          gobject.TYPE_STRING)

      # Main box is vertical
      top_box = gtk.VBox(False, 8)
      top_box.show()
      self.frame.add(top_box)

      # First line label and combo
      label_box = gtk.HBox(False, 8)
      label_box.show()
      top_box.pack_start(label_box, False, False, 0)

      # Let the user select the class to work on
      #
      # Grab the class list and put it in a combo
      class_box = gtk.HBox(False, 8)
      class_box.show()
      label_box.pack_start(class_box, False, False, 0)

      user_label = gtk.Label(_('Select a user:'******'SELECT DISTINCT user_id FROM logs')
      user_list = self.cur.fetchall()

      self.combo_user = gtk.combo_box_new_text()
      self.combo_user.show()

      # Insert the ALL option (HACK, use the user_id -2 to indicate ALL)
      self.combo_user.append_text(_("All users"))
      self.user_list.append(-2)

      for auser in user_list:

        if(auser[0] == -1):
          self.combo_user.append_text(_("Default"))
          self.user_list.append(-1)
          continue

        self.cur.execute('SELECT login, firstname, lastname FROM users WHERE user_id=?',
                         (auser[0],) )
        oneuser = self.cur.fetchall()

        self.combo_user.append_text( (oneuser[0][0] + ' ' +
                                      oneuser[0][1] + ' ' +
                                      oneuser[0][2]))
        # Save in a list the combo index => the user_id
        self.user_list.append(auser[0])

      self.combo_user.set_active(self.current_user_id)
      label_box.pack_end(self.combo_user, True, True, 0)

      # update the combobox
      self.combo_user.connect('changed', self.user_changed_cb)

      # Second line logs and button
      log_hbox = gtk.HBox(False, 8)
      log_hbox.show()
      top_box.add(log_hbox)

      loglist_box = gtk.VBox(False, 8)
      loglist_box.show()
      log_hbox.add(loglist_box)

      vbox_button = gtk.VBox(False, 8)
      vbox_button.show()
      log_hbox.add(vbox_button)


      # Create the table
      sw = gtk.ScrolledWindow()
      sw.show()
      sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
      sw.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)

      # create tree view
      treeview_log = gtk.TreeView(self.log_model)
      treeview_log.show()
      treeview_log.set_rules_hint(True)
      treeview_log.set_search_column(COLUMN_DATE)

      sw.add(treeview_log)

      loglist_box.pack_start(sw, True, True, 0)

      # add columns to the tree view
      self.__add_columns_log(treeview_log)

      # Reset buttons
      self.button_remove = gtk.Button(_('Reset'))
      self.button_remove.connect("clicked", self.on_remove_log_clicked, treeview_log)
      vbox_button.pack_start(self.button_remove, False, False, 0)
      self.button_remove.show()
      self.button_remove.set_sensitive(True)

      # Refresh buttons
      self.button_refresh = gtk.Button(stock='gtk-refresh')
      self.button_refresh.connect("clicked", self.on_refresh_log_clicked)
      vbox_button.pack_start(self.button_refresh, False, False, 0)
      self.button_refresh.show()
      self.button_refresh.set_sensitive(True)

      # Load lists
      self.user_changed_cb(self.combo_user)
      self.reload_log()
예제 #15
0
def _get_wipe_selector(editable_property):
    """
    Returns GUI component for selecting wipe type.
    """
    # Preset luma
    combo_box = gtk.combo_box_new_text()

    # Get options
    keys = mlttransitions.wipe_lumas.keys()
    # translate here
    keys.sort()
    for k in keys:
        combo_box.append_text(k)

    # Set initial value
    k_index = -1
    tokens = editable_property.value.split("/")
    test_value = tokens[len(tokens) - 1]
    for k, v in mlttransitions.wipe_lumas.iteritems():
        if v == test_value:
            k_index = keys.index(k)

    combo_box.set_active(k_index)
    preset_luma_row = _get_two_column_editor_row(
        editable_property.get_display_name(), combo_box)

    # User luma
    use_preset_luma_combo = gtk.combo_box_new_text()
    use_preset_luma_combo.append_text(_("Preset Luma"))
    use_preset_luma_combo.append_text(_("User Luma"))

    dialog = gtk.FileChooserDialog(
        _("Select Luma File"), None, gtk.FILE_CHOOSER_ACTION_OPEN,
        (_("Cancel").encode('utf-8'), gtk.RESPONSE_REJECT,
         _("OK").encode('utf-8'), gtk.RESPONSE_ACCEPT), None)
    dialog.set_action(gtk.FILE_CHOOSER_ACTION_OPEN)
    dialog.set_select_multiple(False)
    file_filter = gtk.FileFilter()
    file_filter.add_pattern("*.png")
    file_filter.add_pattern("*.pgm")
    file_filter.set_name(_("Wipe Luma files"))
    dialog.add_filter(file_filter)

    user_luma_select = gtk.FileChooserButton(dialog)
    user_luma_select.set_size_request(210, 28)

    user_luma_label = gtk.Label(_("Luma File:"))

    if k_index == -1:
        use_preset_luma_combo.set_active(1)
        combo_box.set_sensitive(False)
        combo_box.set_active(0)
        user_luma_select.set_filename(editable_property.value)
    else:
        use_preset_luma_combo.set_active(0)
        user_luma_select.set_sensitive(False)
        user_luma_label.set_sensitive(False)

    user_luma_row = gtk.HBox(False, 2)
    user_luma_row.pack_start(use_preset_luma_combo, False, False, 0)
    user_luma_row.pack_start(gtk.Label(), True, True, 0)
    user_luma_row.pack_start(user_luma_label, False, False, 2)
    user_luma_row.pack_start(user_luma_select, False, False, 0)

    editor_pane = gtk.VBox(False)
    editor_pane.pack_start(preset_luma_row, False, False, 4)
    editor_pane.pack_start(user_luma_row, False, False, 4)

    widgets = (combo_box, use_preset_luma_combo, user_luma_select,
               user_luma_label, keys)

    combo_box.connect("changed", editable_property.combo_selection_changed,
                      keys)
    use_preset_luma_combo.connect("changed", _wipe_preset_combo_changed,
                                  editable_property, widgets)
    dialog.connect('response', _wipe_lumafile_dialog_response,
                   editable_property, widgets)

    return editor_pane
예제 #16
0
    def __init__(self):
        # Create and setup a new window
        #  - titlebar, moveable, resizeable...
        #self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        #  - ontop, sticky, un-moveable, un-resizeable...
        self.window = gtk.Window(gtk.WINDOW_POPUP)
        # Window properties
        self.window.set_title(appname)
        self.window.set_border_width(5)
        self.window.set_size_request(310, 222)
        self.window.set_position(gtk.WIN_POS_CENTER)

        # Connect the destroy event to a handler
        self.window.connect("destroy", lambda x: gtk.main_quit())

        # Create a vertical container box with small padding
        self.vbox = gtk.VBox(False, 2)

        # Create an image
        self.image = gtk.Image()
        self.image.set_from_file(appimage)
        # Integrate it into the vbox
        self.vbox.pack_start(self.image)

        # Create a label notice
        self.label = gtk.Label(appname)
        # Integrate it into the vbox
        self.vbox.pack_start(self.label)

        # Create a scrolled window
        self.scrolledwin = gtk.ScrolledWindow()
        self.scrolledwin.set_shadow_type(gtk.SHADOW_ETCHED_IN)
        self.scrolledwin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        # Integrate it into the vbox
        #  - child, expand, fill, padding
        self.vbox.pack_start(self.scrolledwin, True, True, 0)

        # Create a TreeView object
        liststore = self.create_listmodel()
        self.treeview = gtk.TreeView(liststore)
        self.treeview.connect("row-activated", self.on_clkactivated)
        # Change the bg color of every 2nd row
        self.treeview.set_rules_hint(True)

        # Add the TreeView to the scrolled window
        self.scrolledwin.add(self.treeview)
        # Create TreeView columns
        self.create_columns(self.treeview)

        # Add the vbox to the main window
        self.window.add(self.vbox)

        # Create a button box
        self.bbox = gtk.HButtonBox()
        self.vbox.pack_start(self.bbox, False, False, 0)
        self.bbox.set_layout(gtk.BUTTONBOX_SPREAD)

        # OK button widget
        button = gtk.Button(stock=gtk.STOCK_OK)
        button.connect("clicked", self.on_btnactivated)
        self.bbox.add(button)

        # Close button widget
        button = gtk.Button(stock=gtk.STOCK_CANCEL)
        button.connect("clicked", lambda w: gtk.main_quit())
        self.bbox.add(button)
        # This is the default button
        button.set_flags(gtk.CAN_DEFAULT)
        button.grab_default()

        # Set window icon
        gtk.window_set_default_icon(self.presentation_select_icon())

        # Draw the presentation manager
        self.window.show_all()
예제 #17
0
        self.__cr.restore()


def update_layout(widget, testgraph):
    testgraph.update_layout()


if __name__ == "__main__":
    window = gtk.Window()
    window.connect("delete-event", gtk.main_quit)
    width = 500
    height = 500
    window.resize(width, height)

    testgraph = TestGraph()

    update_button = gtk.Button("Organise graph")
    update_button.connect("clicked", update_layout, testgraph)

    vbox = gtk.VBox(False, 10)
    vbox.pack_start(testgraph, True, True, 0)
    vbox.pack_start(update_button, False, False, 0)

    window.add(vbox)

    testgraph.show()
    vbox.show()
    update_button.show()
    window.present()
    gtk.main()
예제 #18
0
파일: mirrors.py 프로젝트: pombreda/smart
    def __init__(self):

        self._window = gtk.Window()
        self._window.set_icon(getPixbuf("smart"))
        self._window.set_title(_("New Mirror"))
        self._window.set_modal(True)
        self._window.set_position(gtk.WIN_POS_CENTER)

        #self._window.set_geometry_hints(min_width=600, min_height=400)
        def delete(widget, event):
            gtk.main_quit()
            return True

        self._window.connect("delete-event", delete)

        vbox = gtk.VBox()
        vbox.set_border_width(10)
        vbox.set_spacing(10)
        vbox.show()
        self._window.add(vbox)

        table = gtk.Table()
        table.set_row_spacings(10)
        table.set_col_spacings(10)
        table.show()
        vbox.pack_start(table)

        label = gtk.Label(_("Origin URL:"))
        label.set_alignment(1.0, 0.5)
        label.show()
        table.attach(label, 0, 1, 0, 1, gtk.FILL, gtk.FILL)

        self._origin = gtk.Entry()
        self._origin.set_width_chars(40)
        self._origin.show()
        table.attach(self._origin, 1, 2, 0, 1, gtk.EXPAND | gtk.FILL, gtk.FILL)

        label = gtk.Label(_("Mirror URL:"))
        label.set_alignment(1.0, 0.5)
        label.show()
        table.attach(label, 0, 1, 1, 2, gtk.FILL, gtk.FILL)

        self._mirror = gtk.Entry()
        self._mirror.set_width_chars(40)
        self._mirror.show()
        table.attach(self._mirror, 1, 2, 1, 2, gtk.EXPAND | gtk.FILL, gtk.FILL)

        sep = gtk.HSeparator()
        sep.show()
        vbox.pack_start(sep, expand=False)

        bbox = gtk.HButtonBox()
        bbox.set_spacing(10)
        bbox.set_layout(gtk.BUTTONBOX_END)
        bbox.show()
        vbox.pack_start(bbox, expand=False)

        self._okbutton = gtk.Button(stock="gtk-ok")
        self._okbutton.show()

        def clicked(x):
            self._result = True
            gtk.main_quit()

        self._okbutton.connect("clicked", clicked)
        bbox.pack_start(self._okbutton)

        self._cancelbutton = gtk.Button(stock="gtk-cancel")
        self._cancelbutton.show()
        self._cancelbutton.connect("clicked", lambda x: gtk.main_quit())
        bbox.pack_start(self._cancelbutton)
예제 #19
0
    def make_address_list(self, is_recv):
        liststore = self.recv_list if is_recv else self.addressbook_list
        treeview = gtk.TreeView(model=liststore)
        treeview.connect('key-press-event', self.treeview_key_press)
        treeview.connect('button-press-event', self.treeview_button_press)
        treeview.show()
        if not is_recv:
            self.contacts_treeview = treeview

        tvcolumn = gtk.TreeViewColumn('Address')
        treeview.append_column(tvcolumn)
        cell = gtk.CellRendererText()
        cell.set_property('family', MONOSPACE_FONT)
        tvcolumn.pack_start(cell, True)
        tvcolumn.add_attribute(cell, 'text', 0)

        tvcolumn = gtk.TreeViewColumn('Label')
        tvcolumn.set_expand(True)
        treeview.append_column(tvcolumn)
        cell = gtk.CellRendererText()
        cell.set_property('editable', True)

        def edited_cb2(cell, path, new_text, liststore):
            address = liststore.get_value(liststore.get_iter(path), 0)
            self.wallet.labels[address] = new_text
            self.wallet.save()
            self.update_receiving_tab()
            self.update_sending_tab()
            self.update_history_tab()

        cell.connect('edited', edited_cb2, liststore)
        tvcolumn.pack_start(cell, True)
        tvcolumn.add_attribute(cell, 'text', 1)

        tvcolumn = gtk.TreeViewColumn('Tx')
        treeview.append_column(tvcolumn)
        cell = gtk.CellRendererText()
        tvcolumn.pack_start(cell, True)
        tvcolumn.add_attribute(cell, 'text', 2)

        scroll = gtk.ScrolledWindow()
        scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        scroll.add(treeview)

        hbox = gtk.HBox()
        if not is_recv:
            button = gtk.Button("New")
            button.connect("clicked", self.newaddress_dialog)
            button.show()
            hbox.pack_start(button, False)

        def showqrcode(w, treeview, liststore):
            path, col = treeview.get_cursor()
            if not path: return
            address = liststore.get_value(liststore.get_iter(path), 0)
            qr = pyqrnative.QRCode(4, pyqrnative.QRErrorCorrectLevel.H)
            qr.addData(address)
            qr.make()
            boxsize = 7
            size = qr.getModuleCount() * boxsize

            def area_expose_cb(area, event):
                style = area.get_style()
                k = qr.getModuleCount()
                for r in range(k):
                    for c in range(k):
                        gc = style.black_gc if qr.isDark(r,
                                                         c) else style.white_gc
                        area.window.draw_rectangle(gc, True, c * boxsize,
                                                   r * boxsize, boxsize,
                                                   boxsize)

            area = gtk.DrawingArea()
            area.set_size_request(size, size)
            area.connect("expose-event", area_expose_cb)
            area.show()
            dialog = gtk.Dialog(address,
                                parent=self.window,
                                flags=gtk.DIALOG_MODAL
                                | gtk.DIALOG_NO_SEPARATOR,
                                buttons=("ok", 1))
            dialog.vbox.add(area)
            dialog.run()
            dialog.destroy()

        button = gtk.Button("QR")
        button.connect("clicked", showqrcode, treeview, liststore)
        button.show()
        hbox.pack_start(button, False)

        button = gtk.Button("Copy to clipboard")

        def copy2clipboard(w, treeview, liststore):
            import platform
            path, col = treeview.get_cursor()
            if path:
                address = liststore.get_value(liststore.get_iter(path), 0)
                if platform.system() == 'Windows':
                    from Tkinter import Tk
                    r = Tk()
                    r.withdraw()
                    r.clipboard_clear()
                    r.clipboard_append(address)
                    r.destroy()
                else:
                    c = gtk.clipboard_get()
                    c.set_text(address)

        button.connect("clicked", copy2clipboard, treeview, liststore)
        button.show()
        hbox.pack_start(button, False)

        if not is_recv:
            button = gtk.Button("Pay to")

            def payto(w, treeview, liststore):
                path, col = treeview.get_cursor()
                if path:
                    address = liststore.get_value(liststore.get_iter(path), 0)
                    self.payto_entry.set_text(address)
                    self.notebook.set_current_page(1)
                    self.amount_entry.grab_focus()

            button.connect("clicked", payto, treeview, liststore)
            button.show()
            hbox.pack_start(button, False)

        vbox = gtk.VBox()
        vbox.pack_start(scroll, True)
        vbox.pack_start(hbox, False)
        return vbox
예제 #20
0
파일: mirrors.py 프로젝트: pombreda/smart
    def __init__(self, parent=None):

        self._window = gtk.Window()
        self._window.set_icon(getPixbuf("smart"))
        self._window.set_title(_("Mirrors"))
        self._window.set_modal(True)
        self._window.set_transient_for(parent)
        self._window.set_position(gtk.WIN_POS_CENTER)
        self._window.set_geometry_hints(min_width=600, min_height=400)

        def delete(widget, event):
            gtk.main_quit()
            return True

        self._window.connect("delete-event", delete)

        vbox = gtk.VBox()
        vbox.set_border_width(10)
        vbox.set_spacing(10)
        vbox.show()
        self._window.add(vbox)

        sw = gtk.ScrolledWindow()
        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_ALWAYS)
        sw.set_shadow_type(gtk.SHADOW_IN)
        sw.show()
        vbox.add(sw)

        self._treemodel = gtk.TreeStore(gobject.TYPE_STRING)
        self._treeview = gtk.TreeView(self._treemodel)
        self._treeview.set_rules_hint(True)
        self._treeview.set_headers_visible(False)
        self._treeview.show()
        sw.add(self._treeview)

        renderer = gtk.CellRendererText()
        renderer.set_property("xpad", 3)
        renderer.set_property("editable", True)
        renderer.connect("edited", self.rowEdited)
        self._treeview.insert_column_with_attributes(-1,
                                                     _("Mirror"),
                                                     renderer,
                                                     text=0)

        bbox = gtk.HButtonBox()
        bbox.set_spacing(10)
        bbox.set_layout(gtk.BUTTONBOX_END)
        bbox.show()
        vbox.pack_start(bbox, expand=False)

        button = gtk.Button(stock="gtk-new")
        button.show()
        button.connect("clicked", lambda x: self.newMirror())
        bbox.pack_start(button)

        button = gtk.Button(stock="gtk-delete")
        button.show()
        button.connect("clicked", lambda x: self.delMirror())
        bbox.pack_start(button)

        button = gtk.Button(stock="gtk-close")
        button.show()
        button.connect("clicked", lambda x: gtk.main_quit())
        bbox.pack_start(button)
예제 #21
0
    def create_send_tab(self):

        page = vbox = gtk.VBox()
        page.show()

        payto = gtk.HBox()
        payto_label = gtk.Label('Pay to:')
        payto_label.set_size_request(100, -1)
        payto.pack_start(payto_label, False)
        payto_entry = gtk.Entry()
        payto_entry.set_size_request(450, 26)
        payto.pack_start(payto_entry, False)
        vbox.pack_start(payto, False, False, 5)

        message = gtk.HBox()
        message_label = gtk.Label('Description:')
        message_label.set_size_request(100, -1)
        message.pack_start(message_label, False)
        message_entry = gtk.Entry()
        message_entry.set_size_request(450, 26)
        message.pack_start(message_entry, False)
        vbox.pack_start(message, False, False, 5)

        amount_box = gtk.HBox()
        amount_label = gtk.Label('Amount:')
        amount_label.set_size_request(100, -1)
        amount_box.pack_start(amount_label, False)
        amount_entry = gtk.Entry()
        amount_entry.set_size_request(120, -1)
        amount_box.pack_start(amount_entry, False)
        vbox.pack_start(amount_box, False, False, 5)

        self.fee_box = fee_box = gtk.HBox()
        fee_label = gtk.Label('Fee:')
        fee_label.set_size_request(100, -1)
        fee_box.pack_start(fee_label, False)
        fee_entry = gtk.Entry()
        fee_entry.set_size_request(60, 26)
        fee_box.pack_start(fee_entry, False)
        vbox.pack_start(fee_box, False, False, 5)

        end_box = gtk.HBox()
        empty_label = gtk.Label('')
        empty_label.set_size_request(100, -1)
        end_box.pack_start(empty_label, False)
        send_button = gtk.Button("Send")
        send_button.show()
        end_box.pack_start(send_button, False, False, 0)
        clear_button = gtk.Button("Clear")
        clear_button.show()
        end_box.pack_start(clear_button, False, False, 15)
        send_button.connect(
            "clicked", self.do_send,
            (payto_entry, message_entry, amount_entry, fee_entry))
        clear_button.connect(
            "clicked", self.do_clear,
            (payto_entry, message_entry, amount_entry, fee_entry))

        vbox.pack_start(end_box, False, False, 5)

        # display this line only if there is a signature
        payto_sig = gtk.HBox()
        payto_sig_id = gtk.Label('')
        payto_sig.pack_start(payto_sig_id, False)
        vbox.pack_start(payto_sig, True, True, 5)

        self.user_fee = False

        def entry_changed(entry, is_fee):
            self.funds_error = False
            amount = numbify(amount_entry)
            fee = numbify(fee_entry)
            if not is_fee: fee = None
            if amount is None:
                return
            inputs, total, fee = self.wallet.choose_tx_inputs(amount, fee)
            if not is_fee:
                fee_entry.set_text(str(Decimal(fee) / 100000000))
                self.fee_box.show()
            if inputs:
                amount_entry.modify_text(gtk.STATE_NORMAL,
                                         gtk.gdk.color_parse("#000000"))
                fee_entry.modify_text(gtk.STATE_NORMAL,
                                      gtk.gdk.color_parse("#000000"))
                send_button.set_sensitive(True)
            else:
                send_button.set_sensitive(False)
                amount_entry.modify_text(gtk.STATE_NORMAL,
                                         gtk.gdk.color_parse("#cc0000"))
                fee_entry.modify_text(gtk.STATE_NORMAL,
                                      gtk.gdk.color_parse("#cc0000"))
                self.funds_error = True

        amount_entry.connect('changed', entry_changed, False)
        fee_entry.connect('changed', entry_changed, True)

        self.payto_entry = payto_entry
        self.payto_fee_entry = fee_entry
        self.payto_sig_id = payto_sig_id
        self.payto_sig = payto_sig
        self.amount_entry = amount_entry
        self.message_entry = message_entry
        self.add_tab(page, 'Send')
예제 #22
0
    def __init__(self):
        gtk.Window.__init__(self)
        bdb.Bdb.__init__(self)
        self.realize()

        self.set_title("PyGTKDb")
        self.connect("destroy", self.do_quit)
        self.connect("delete_event", self.do_quit)

        self.box = gtk.VBox()
        self.add(self.box)
        self.box.show()

        self.add_stock_ids()

        actions = [
            ('Next', 'pyide-next', None, None, "Next statement", self.do_next),
            ('Step', 'pyide-step', None, None, "Step into function",
             self.do_step),
            ('Return', 'pyide-return', None, None,
             "Continue execution to end of function", self.do_return),
            ('Continue', 'pyide-continue', None, None,
             "Continue execution to next break point", self.do_continue),
            ('Break', 'pyide-break', None, None,
             "Toggle break point at selected line", self.do_break),
            ('Edit', 'pyide-edit', None, None,
             "Edit the value of the selected variable", self.do_edit),
            ('Run', 'pyide-run', None, None,
             "Execute some code in the current stack context", self.do_run),
            ('Quit', 'pyide-quit', None, None, "Quit the debugger",
             self.do_quit),
            ]

        self.ag = gtk.ActionGroup('PyIDE Actions')
        self.ag.add_actions(actions)
        self.ui = gtk.UIManager()
        self.ui.insert_action_group(self.ag, 0)
        self.ui.add_ui_from_string(self.ui_string)
        self.add_accel_group(self.ui.get_accel_group())

        self.box.pack_start(self.ui.get_widget('/Toolbar'), expand=False)
        sep = gtk.HSeparator()
        self.box.pack_start(sep, expand=False)
        sep.show()

        vpane = gtk.VPaned()
        self.box.pack_start(vpane)
        vpane.show()

        hpane = gtk.HPaned()
        vpane.add1(hpane)
        hpane.show()

        swin = gtk.ScrolledWindow()
        swin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        hpane.add1(swin)
        swin.show()

        ls = gtk.ListStore(str)
        self.stackdisp = gtk.TreeView(ls)
        tvc = gtk.TreeViewColumn('Stack Frame', gtk.CellRendererText(),
                                 text=0)
        self.stackdisp.append_column(tvc)
        self.stackdisp.set_size_request(280, 125)
        selection = self.stackdisp.get_selection()
        selection.set_mode(gtk.SELECTION_BROWSE)
        selection.connect("changed", self.update_curstack)
 
        self.stackdisp.set_border_width(2)
        swin.add(self.stackdisp)
        self.stackdisp.show()

        swin = gtk.ScrolledWindow()
        swin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        hpane.add2(swin)
        swin.show()

        ls = gtk.ListStore(str, str, str)
        self.vardisp = gtk.TreeView(ls)
        titles = ['local var', 'type', 'value']
        for n in range(len(titles)):
            tvc = gtk.TreeViewColumn(titles[n], gtk.CellRendererText(),
                                     text=n)
            self.vardisp.append_column(tvc)

        selection = self.vardisp.get_selection()
        selection.set_mode(gtk.SELECTION_BROWSE)
        selection.connect("changed", self.update_selectedvar)
        self.vardisp.set_border_width(2)

        self.vardisp.set_border_width(2)
        swin.add(self.vardisp)
        self.vardisp.show()
        self.vardisp.selected = 0
        self.vardisp.varnames = []

        swin = gtk.ScrolledWindow()
        swin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        vpane.add2(swin)
        swin.show()

        self.minibreak = gtk.Image()
        self.minibreak.set_from_file("minibreak.xpm")
        self.minibreak.show()
        ls = gtk.ListStore(gtk.gdk.Pixbuf, str, str)
        self.filedisp = gtk.TreeView(ls)
        titles = ['break', 'lineno', 'line']
        cell = gtk.CellRendererPixbuf()
        tvc = gtk.TreeViewColumn(None, cell, pixbuf=0)
        tvc.set_min_width(14)
        tvc.set_widget(self.minibreak)
        self.filedisp.append_column(tvc)
        cell = gtk.CellRendererText()
        cell.set_property('xalign', 1.0)
        tvc = gtk.TreeViewColumn(titles[1], cell, text=1)
        self.filedisp.append_column(tvc)
        cell = gtk.CellRendererText()
        tvc = gtk.TreeViewColumn(titles[2], cell, text=2)
        self.filedisp.append_column(tvc)
        self.minibreak = self.minibreak.get_pixbuf()
        selection = self.filedisp.get_selection()
        selection.set_mode(gtk.SELECTION_BROWSE)
        selection.connect("changed", self.update_selection)
        self.filedisp.connect('row-activated', lambda t,p,c: self.do_break())
        self.filedisp.set_border_width(2)
        self.filedisp.set_size_request(600, 200)
        swin.add(self.filedisp)
        self.filedisp.show()

        separator = gtk.HSeparator()
        self.box.pack_start(separator, expand=False)
        separator.show()

        align = gtk.Alignment(0.0, 0.5, 0.0, 0.0)
        self.box.pack_start(align, expand=False)
        align.show()
        self.status = gtk.Label()
        self.status.set_padding(4, 1)
        align.add(self.status)
        self.status.show()

        self.filename = None
        self.selected = 0
        self.blockupdate = 0
        return
예제 #23
0
파일: uzbl_tabbed.py 프로젝트: dagle/uzbl
    def __init__(self):
        '''Create tablist, window and notebook.'''

        self._fifos = {}
        self._timers = {}
        self._buffer = ""

        # Once a second is updated with the latest tabs' uris so that when the
        # window is killed the session is saved.
        self._tabsuris = []
        # And index of current page in self._tabsuris
        self._curpage = 0

        # Holds metadata on the uzbl childen open.
        self.tabs = {}

        # Generates a unique id for uzbl socket filenames.
        self.next_pid = counter().next

        # Create main window
        self.window = gtk.Window()
        try:
            window_size = map(int, config['window_size'].split(','))
            self.window.set_default_size(*window_size)

        except:
            error("Invalid value for default_size in config file.")

        self.window.set_title("Uzbl Browser")
        self.window.set_border_width(0)

        # Set main window icon
        icon_path = config['icon_path']
        if os.path.exists(icon_path):
            self.window.set_icon(gtk.gdk.pixbuf_new_from_file(icon_path))

        else:
            icon_path = '/usr/share/uzbl/examples/data/uzbl/uzbl.png'
            if os.path.exists(icon_path):
                self.window.set_icon(gtk.gdk.pixbuf_new_from_file(icon_path))

        # Attach main window event handlers
        self.window.connect("delete-event", self.quit)

        # Create tab list
        if config['show_tablist']:
            vbox = gtk.VBox()
            self.window.add(vbox)
            ebox = gtk.EventBox()
            self.tablist = gtk.Label()
            self.tablist.set_use_markup(True)
            self.tablist.set_justify(gtk.JUSTIFY_LEFT)
            self.tablist.set_line_wrap(False)
            self.tablist.set_selectable(False)
            self.tablist.set_padding(2, 2)
            self.tablist.set_alignment(0, 0)
            self.tablist.set_ellipsize(pango.ELLIPSIZE_END)
            self.tablist.set_text(" ")
            self.tablist.show()
            ebox.add(self.tablist)
            ebox.show()
            bgcolor = gtk.gdk.color_parse(config['status_background'])
            ebox.modify_bg(gtk.STATE_NORMAL, bgcolor)

        # Create notebook
        self.notebook = gtk.Notebook()
        self.notebook.set_show_tabs(config['show_gtk_tabs'])

        # Set tab position
        allposes = {
            'left': gtk.POS_LEFT,
            'right': gtk.POS_RIGHT,
            'top': gtk.POS_TOP,
            'bottom': gtk.POS_BOTTOM
        }
        if config['gtk_tab_pos'] in allposes.keys():
            self.notebook.set_tab_pos(allposes[config['gtk_tab_pos']])

        self.notebook.set_show_border(False)
        self.notebook.set_scrollable(True)
        self.notebook.set_border_width(0)

        self.notebook.connect("page-removed", self.tab_closed)
        self.notebook.connect("switch-page", self.tab_changed)
        self.notebook.connect("page-added", self.tab_opened)

        self.notebook.show()
        if config['show_tablist']:
            if config['tablist_top']:
                vbox.pack_start(ebox, False, False, 0)
                vbox.pack_end(self.notebook, True, True, 0)

            else:
                vbox.pack_start(self.notebook, True, True, 0)
                vbox.pack_end(ebox, False, False, 0)

            vbox.show()

        else:
            self.window.add(self.notebook)

        self.window.show()
        self.wid = self.notebook.window.xid

        # Create the uzbl_tabbed fifo
        fifo_filename = 'uzbltabbed_%d' % os.getpid()
        self.fifo_socket = os.path.join(config['fifo_dir'], fifo_filename)
        self._create_fifo_socket(self.fifo_socket)
        self._setup_fifo_watcher(self.fifo_socket)
예제 #24
0
    def __init__(self, mainwindow):
        '''
        Initialize the window
        @param mainwindow: reference to the parent window
        '''
        gtk.HBox.__init__(self)
        self.mainwindow = mainwindow
        self.config = mainwindow.config
        self.section = type(self).__name__
        h1 = gtk.VBox()

        ##############################################################################

        self.fin = gtk.FileChooserButton("file")
        #        self.fin.set_current_folder("")
        #TODO
        self.fin.set_current_folder("$HESSUSER/RoundUp/Maps")
        self.fin.set_action(gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER)
        self.fin.show()

        # Simulated spectrum
        f = gtk.Frame("Root files")
        h1.pack_start(f, expand=False, fill=False, padding=5)
        t = gtk.Table(5, 2)
        f.add(t)
        t.attach(self.fin, 0, 2, 0, 1, gtk.EXPAND | gtk.FILL,
                 gtk.EXPAND | gtk.FILL, 5, 5)
        #        t.attach(gtk.Label("Spectral Index"), 0, 1, 1, 2, gtk.EXPAND | gtk.FILL, 5, 5)

        #Load file list button
        self.load_button = gtk_supp.PixmapButton(gtk.STOCK_OPEN,
                                                 "Load file list")
        self.load_button.connect("clicked", self.load_run_list)
        #        h1.pack_start(self.load_button, expand=False, fill=False, padding=1)
        t.attach(self.load_button, 2, 3, 0, 1, gtk.EXPAND | gtk.FILL,
                 gtk.EXPAND | gtk.FILL, 5, 5)

        ##############################################################################
        # ==== default values ====
        self.ra_mode = True
        self.ra = 0.
        self.dec = 0.
        self.MinSig = 4.5
        self.UseConfigTarget = 1

        f = gtk.Frame("Target ")
        h1.pack_start(f, expand=False, fill=False, padding=5)
        t3 = gtk.Table(3, 3)
        f.add(t3)

        self.UseConfigTarget_button = SignalWidgets.CheckButton(
            "Config from File results")
        self.UseConfigTarget_button.set_active(True)
        t3.attach(self.UseConfigTarget_button, 0, 3, 1, 2,
                  gtk.EXPAND | gtk.FILL, gtk.EXPAND | gtk.FILL, 5, 1)
        self.UseConfigTarget_button.connect("toggled",
                                            self.changed_UseConfigTarget)

        t3.attach(gtk.Label("Target Name"), 0, 1, 2, 3, gtk.EXPAND | gtk.FILL,
                  gtk.EXPAND | gtk.FILL, 5, 1)
        self.target_list = gtk_supp.EntryCompletion(0)
        self.target_list.set_size_request(150, -1)
        t3.attach(self.target_list, 1, 2, 2, 3, gtk.EXPAND | gtk.FILL,
                  gtk.EXPAND | gtk.FILL, 5, 1)

        self.filter_pos_button = gtk_supp.PixmapButton(gtk.STOCK_EXECUTE,
                                                       "Lookup")
        self.filter_pos_button.set_size_request(150, -1)
        self.filter_pos_button.connect("clicked", self.lookup_pos)
        t3.attach(self.filter_pos_button, 2, 4, 2, 3, gtk.EXPAND | gtk.FILL,
                  gtk.EXPAND | gtk.FILL, 5, 1)

        self.ra_label = gtk.Label("RA :")
        t3.attach(self.ra_label, 1, 2, 3, 4, gtk.EXPAND | gtk.FILL,
                  gtk.EXPAND | gtk.FILL, 5, 1)

        self.ra_entry = gtk.SpinButton(gtk.Adjustment(self.ra, -360, 360, .1),
                                       .5, 4)
        self.ra_entry.set_numeric(True)
        self.ra_entry.set_size_request(30, -1)
        t3.attach(self.ra_entry, 2, 3, 3, 4, gtk.EXPAND | gtk.FILL,
                  gtk.EXPAND | gtk.FILL, 5, 1)

        self.dec_label = gtk.Label("DEC :")
        t3.attach(self.dec_label, 1, 2, 4, 5, gtk.EXPAND | gtk.FILL,
                  gtk.EXPAND | gtk.FILL, 5, 1)

        self.dec_entry = gtk.SpinButton(gtk.Adjustment(self.dec, -90, 90, .1),
                                        .5, 4)
        self.dec_entry.set_numeric(True)
        self.dec_entry.set_size_request(30, -1)
        t3.attach(self.dec_entry, 2, 3, 4, 5, gtk.EXPAND | gtk.FILL,
                  gtk.EXPAND | gtk.FILL, 5, 1)

        self.target_list.set_sensitive(False)
        self.filter_pos_button.set_sensitive(False)
        self.ra_label.set_sensitive(False)
        self.ra_entry.set_sensitive(False)
        self.dec_label.set_sensitive(False)
        self.dec_entry.set_sensitive(False)

        #Start button
        self.exec_button = gtk_supp.PixmapButton(gtk.STOCK_EXECUTE,
                                                 "ONOFF Test @ Pos")
        self.exec_button.connect("clicked", self.start_ONOFFTest)
        # h1.pack_start(self.exec_button, expand=False, fill=False, padding=1)
        t3.attach(self.exec_button, 0, 2, 5, 6, gtk.EXPAND | gtk.FILL,
                  gtk.EXPAND | gtk.FILL, 5, 1)

        #Start button
        self.exec_buttonFP = gtk_supp.PixmapButton(gtk.STOCK_EXECUTE,
                                                   "Info @ Pos")
        self.exec_buttonFP.connect("clicked", self.start_findPos)
        # h1.pack_start(self.exec_buttonFP, expand=False, fill=False, padding=1)
        t3.attach(self.exec_buttonFP, 2, 4, 5, 6, gtk.EXPAND | gtk.FILL,
                  gtk.EXPAND | gtk.FILL, 5, 1)

        f2 = gtk.Frame("Tools ")
        h1.pack_start(f2, expand=False, fill=False, padding=5)
        ttools = gtk.Table(3, 2)
        f2.add(ttools)

        # #Start button
        # self.exec_buttonFP = gtk_supp.PixmapButton(gtk.STOCK_EXECUTE, "Start FindPosition")
        # self.exec_buttonFP.connect("clicked", self.start_findPos)
        # # h1.pack_start(self.exec_buttonFP, expand=False, fill=False, padding=1)
        # ttools.attach(self.exec_buttonFP, 1, 2, 4,5, gtk.EXPAND | gtk.FILL, gtk.EXPAND | gtk.FILL, 5, 1)

        #Start button
        self.exec_buttonFindspot = gtk_supp.PixmapButton(
            gtk.STOCK_EXECUTE, "Find Hot Spot (Significance) ")
        self.exec_buttonFindspot.connect("clicked", self.start_FindHotSpot)
        # h1.pack_start(self.exec_buttonFindspot, expand=False, fill=False, padding=1)
        ttools.attach(self.exec_buttonFindspot, 1, 2, 2, 3,
                      gtk.EXPAND | gtk.FILL, gtk.EXPAND | gtk.FILL, 5, 1)

        self.minsig_label = gtk.Label("Min Significance :")
        ttools.attach(self.minsig_label, 2, 3, 2, 3, gtk.EXPAND | gtk.FILL,
                      gtk.EXPAND | gtk.FILL, 5, 1)

        self.MinSig_entry = gtk.SpinButton(
            gtk.Adjustment(self.MinSig, 0, 90, .1), .1, 4)
        self.MinSig_entry.set_numeric(True)
        self.MinSig_entry.set_size_request(30, -1)
        ttools.attach(self.MinSig_entry, 3, 4, 2, 3, gtk.EXPAND | gtk.FILL,
                      gtk.EXPAND | gtk.FILL, 5, 1)

        #Start button
        self.exec_buttonFindspot = gtk_supp.PixmapButton(
            gtk.STOCK_EXECUTE, "Find Hot Spot (ONOFF) ")
        self.exec_buttonFindspot.connect("clicked",
                                         self.start_FindHotSpotONOFF)
        # h1.pack_start(self.exec_buttonFindspot, expand=False, fill=False, padding=1)
        ttools.attach(self.exec_buttonFindspot, 1, 2, 3, 4,
                      gtk.EXPAND | gtk.FILL, gtk.EXPAND | gtk.FILL, 5, 1)

        #Start button
        self.exec_buttonDrawMap = gtk_supp.PixmapButton(
            gtk.STOCK_EXECUTE, "Open Results Maps")
        self.exec_buttonDrawMap.connect("clicked", self.start_OpenResults)
        h1.pack_start(self.exec_buttonDrawMap,
                      expand=False,
                      fill=False,
                      padding=1)

        #        tsum= gtk.Table(3, 3)
        #        f.add(tsum)

        self.exec_MakeSummary = gtk_supp.PixmapButton(gtk.STOCK_EXECUTE,
                                                      "Make Summary")
        self.exec_MakeSummary.connect("clicked", self.start_MakeSummary)
        h1.pack_start(self.exec_MakeSummary,
                      expand=False,
                      fill=False,
                      padding=1)

        #        ##############################################################################
        #        #Selection window
        self.pack_start(h1, expand=False, fill=True, padding=5)
        h1 = gtk.VBox()
        self.pack_start(h1, expand=True, fill=True, padding=5)
        #        self.list = gtk_supp.SortList(1, (""))
        self.list = gtk_supp.SortList(2, ("filename", "size"))
        self.list.set_selection_mode(gtk.SELECTION_EXTENDED)
        self.list.set_size_request(400, -1)
        self.list.set_column_width(0, 400)
        self.list.set_column_width(1, 100)
        swin = gtk.ScrolledWindow()
        swin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        swin.set_size_request(-1, -1)
        swin.add(self.list)
        h1.pack_start(swin, expand=True, fill=True, padding=5)
예제 #25
0
파일: menu.py 프로젝트: kaday/rose
 def get_orphan_container(self, page):
     """Return a container with the page object inside."""
     box = gtk.VBox()
     box.pack_start(page, expand=True, fill=True)
     box.show()
     return box
예제 #26
0
파일: about.py 프로젝트: themylogin/sonata
    def about_shortcuts(self, _button):
        # define the shortcuts and their descriptions
        # these are all gettextable
        mainshortcuts = \
                [[ "F1", _("About Sonata") ],
                 [ "F5", _("Preferences") ],
                 [ "F11", _("Fullscreen Artwork Mode") ],
                 [ "Alt-[1-5]", _("Switch to [1st-5th] tab") ],
                 [ "Alt-C", _("Connect to MPD") ],
                 [ "Alt-D", _("Disconnect from MPD") ],
                 [ "Alt-R", _("Randomize current playlist") ],
                 [ "Alt-Down", _("Expand player") ],
                 [ "Alt-Left", _("Switch to previous tab") ],
                 [ "Alt-Right", _("Switch to next tab") ],
                 [ "Alt-Up", _("Collapse player") ],
                 [ "Ctrl-H", _("Search library") ],
                 [ "Ctrl-Q", _("Quit") ],
                 [ "Ctrl-Shift-U", _("Update entire library") ],
                 [ "Menu", _("Display popup menu") ],
                 [ "Escape", _("Minimize to system tray (if enabled)") ]]
        playbackshortcuts = \
                [[ "Ctrl-Left", _("Previous track") ],
                 [ "Ctrl-Right", _("Next track") ],
                 [ "Ctrl-P", _("Play/Pause") ],
                 [ "Ctrl-S", _("Stop") ],
                 [ "Ctrl-Minus", _("Lower the volume") ],
                 [ "Ctrl-Plus", _("Raise the volume") ]]
        currentshortcuts = \
                [[ "Enter/Space", _("Play selected song") ],
                 [ "Delete", _("Remove selected song(s)") ],
                 [ "Ctrl-I", _("Center currently playing song") ],
                 [ "Ctrl-T", _("Edit selected song's tags") ],
                 [ "Ctrl-Shift-S", _("Save to new playlist") ],
                 [ "Ctrl-Delete", _("Clear list") ],
                 [ "Alt-R", _("Randomize list") ]]
        libraryshortcuts = \
                [[ "Enter/Space", _("Add selected song(s) or enter directory") ],
                 [ "Backspace", _("Go to parent directory") ],
                 [ "Ctrl-D", _("Add selected item(s)") ],
                 [ "Ctrl-R", _("Replace with selected item(s)") ],
                 [ "Ctrl-T", _("Edit selected song's tags") ],
                 [ "Ctrl-Shift-D", _("Add selected item(s) and play") ],
                 [ "Ctrl-Shift-R", _("Replace with selected item(s) and play") ],
                 [ "Ctrl-U", _("Update selected item(s)/path(s)") ]]
        playlistshortcuts = \
                [[ "Enter/Space", _("Add selected playlist(s)") ],
                 [ "Delete", _("Remove selected playlist(s)") ],
                 [ "Ctrl-D", _("Add selected playlist(s)") ],
                 [ "Ctrl-R", _("Replace with selected playlist(s)") ],
                 [ "Ctrl-Shift-D", _("Add selected playlist(s) and play") ],
                 [ "Ctrl-Shift-R", _("Replace with selected playlist(s) and play") ]]
        streamshortcuts = \
                [[ "Enter/Space", _("Add selected stream(s)") ],
                 [ "Delete", _("Remove selected stream(s)") ],
                 [ "Ctrl-D", _("Add selected stream(s)") ],
                 [ "Ctrl-R", _("Replace with selected stream(s)") ],
                 [ "Ctrl-Shift-D", _("Add selected stream(s) and play") ],
                 [ "Ctrl-Shift-R", _("Replace with selected stream(s) and play") ]]
        infoshortcuts = \
                [[ "Ctrl-T", _("Edit playing song's tags") ]]
        # define the main array- this adds headings to each section of
        # shortcuts that will be displayed
        shortcuts = [[ _("Main Shortcuts"), mainshortcuts ],
                [ _("Playback Shortcuts"), playbackshortcuts ],
                [ _("Current Shortcuts"), currentshortcuts ],
                [ _("Library Shortcuts"), libraryshortcuts ],
                [ _("Playlist Shortcuts"), playlistshortcuts ],
                [ _("Stream Shortcuts"), streamshortcuts ],
                [ _("Info Shortcuts"), infoshortcuts ]]
        dialog = ui.dialog(title=_("Shortcuts"), parent=self.about_dialog, flags=gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE), role='shortcuts', default=gtk.RESPONSE_CLOSE, h=320)

        # each pair is a [ heading, shortcutlist ]
        vbox = gtk.VBox()
        for pair in shortcuts:
            titlelabel = ui.label(markup="<b>%s</b>" % pair[0])
            vbox.pack_start(titlelabel, False, False, 2)

            # print the items of [ shortcut, desc ]
            for item in pair[1]:
                tmphbox = gtk.HBox()

                tmplabel = ui.label(markup="<b>%s:</b>" % item[0], y=0)
                tmpdesc = ui.label(text=item[1], wrap=True, y=0)

                tmphbox.pack_start(tmplabel, False, False, 2)
                tmphbox.pack_start(tmpdesc, True, True, 2)

                vbox.pack_start(tmphbox, False, False, 2)
            vbox.pack_start(ui.label(text=" "), False, False, 2)
        scrollbox = ui.scrollwindow(policy_x=gtk.POLICY_NEVER, addvp=vbox)
        dialog.vbox.pack_start(scrollbox, True, True, 2)
        dialog.show_all()
        dialog.run()
        dialog.destroy()
예제 #27
0
    def __init__(self, w3af):
        super(VulnAddDialog,
              self).__init__("Add new vulnerability", None,
                             gtk.MESSAGE_QUESTION,
                             (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                              gtk.STOCK_ADD, gtk.RESPONSE_OK))
        self.set_icon_from_file(W3AF_ICON)

        self.w3af = w3af

        # Main hbox
        hbox = gtk.HBox()
        hbox.show()
        image = gtk.Image()
        image.set_from_stock(gtk.STOCK_DIALOG_QUESTION, gtk.ICON_SIZE_DIALOG)
        image.set_padding(20, 20)
        image.show()

        hbox.pack_start(image)

        # Vbox with all the information for the right section of the dialog
        vbox = gtk.VBox()

        # Add a label
        align = gtk.Alignment()
        align.set_padding(10, 0, 0, 10)
        label = gtk.Label('Choose the vulnerability template to use:')
        align.add(label)
        vbox.pack_start(align)

        template_long_names = get_template_long_names()
        template_names = get_template_names()
        self.vuln_template = None

        # A list store with the following columns:
        #    * Long template name (show)
        #    * Template name (code internals)
        liststore = gtk.ListStore(str, str)
        self.combobox = gtk.ComboBox(liststore)
        cell = gtk.CellRendererText()
        self.combobox.pack_start(cell, True)
        self.combobox.add_attribute(cell, 'text', 0)
        self.combobox.connect("changed", self._changed_combo)

        for i, long_name in enumerate(template_long_names):
            liststore.append((long_name, template_names[i]))

        vbox.pack_start(self.combobox, False, False)
        vbox.pack_start(gtk.Label())

        # the Cancel button
        but = self.action_area.get_children()[1]
        but.connect("clicked", lambda x: self.destroy())
        self.connect("delete-event", lambda x, y: self.destroy())

        # the Ok button
        self.ok_but = self.action_area.get_children()[0]
        self.ok_but.connect("clicked", self._ok)
        self.ok_but.set_sensitive(False)

        hbox.pack_start(vbox)

        self.vbox.pack_start(hbox)
        self.show_all()
예제 #28
0
    def __init__(self, *args, **kwargs):
        gtk.Window.__init__(self, *args, **kwargs)
        self.set_title('Spell check')
        self.set_default_size(350, 200)

        self._checker = None
        self._numContext = 40

        self.errors = None

        # create accel group
        accel_group = gtk.AccelGroup()
        self.add_accel_group(accel_group)

        # list of widgets to disable if there's no spell error left
        self._conditional_widgets = []
        conditional = self._conditional_widgets.append

        # layout
        mainbox = gtk.VBox(spacing=5)
        hbox = gtk.HBox(spacing=5)
        self.add(mainbox)
        mainbox.pack_start(hbox, padding=5)

        box1 = gtk.VBox(spacing=5)
        hbox.pack_start(box1, padding=5)
        conditional(box1)

        # unreconized word
        text_view_lable = gtk.Label('Unreconized word')
        text_view_lable.set_justify(gtk.JUSTIFY_LEFT)
        box1.pack_start(text_view_lable, False, False)

        text_view = gtk.TextView()
        text_view.set_wrap_mode(gtk.WRAP_WORD)
        text_view.set_editable(False)
        text_view.set_cursor_visible(False)
        self.error_text = text_view.get_buffer()
        text_buffer = text_view.get_buffer()
        text_buffer.create_tag("fg_black", foreground="black")
        text_buffer.create_tag("fg_red", foreground="red")

        box1.pack_start(text_view)

        # Change to
        change_to_box = gtk.HBox()
        box1.pack_start(change_to_box, False, False)

        change_to_label = gtk.Label('Change to:')
        self.replace_text = gtk.Entry()
        text_view_lable.set_justify(gtk.JUSTIFY_LEFT)
        change_to_box.pack_start(change_to_label, False, False)
        change_to_box.pack_start(self.replace_text)

        # scrolled window
        sw = gtk.ScrolledWindow()
        sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        box1.pack_start(sw)

        self.suggestion_list_view = create_list_view('Suggestions')
        self.suggestion_list_view.connect("button_press_event",
                                          self._onButtonPress)
        self.suggestion_list_view.connect("cursor-changed",
                                          self._onSuggestionChanged)
        sw.add(self.suggestion_list_view)

        #---Buttons---#000000#FFFFFF----------------------------------------------------
        button_box = gtk.VButtonBox()
        hbox.pack_start(button_box, False, False)

        # Ignore
        button = gtk.Button("Ignore")
        button.connect("clicked", self._onIgnore)
        button.add_accelerator("activate", accel_group, gtk.keysyms.Return, 0,
                               gtk.ACCEL_VISIBLE)
        button_box.pack_start(button)
        conditional(button)

        # Ignore all
        button = gtk.Button("Ignore All")
        button.connect("clicked", self._onIgnoreAll)
        button_box.pack_start(button)
        conditional(button)

        # Replace
        button = gtk.Button("Replace")
        button.connect("clicked", self._onReplace)
        button_box.pack_start(button)
        conditional(button)

        # Replace all
        button = gtk.Button("Replace All")
        button.connect("clicked", self._onReplaceAll)
        button_box.pack_start(button)
        conditional(button)

        # Recheck button
        button = gtk.Button("_Add")
        button.connect("clicked", self._onAdd)

        button_box.pack_start(button)
        conditional(button)

        # Close button
        button = gtk.Button(stock=gtk.STOCK_CLOSE)
        button.connect("clicked", self._onClose)
        button.add_accelerator("activate", accel_group, gtk.keysyms.Escape, 0,
                               gtk.ACCEL_VISIBLE)
        button_box.pack_end(button)

        # dictionary label
        self._dict_lable = gtk.Label('')
        mainbox.pack_start(self._dict_lable, False, False, padding=5)

        mainbox.show_all()
예제 #29
0
    def __init__(self):
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window.connect("destroy", self.destroy)
        self.window.set_default_size(400, 300)
        self.window.set_border_width(20)

        # Title
        vbox = gtk.VBox(False, 0)
        vbox.set_spacing(15)
        label = gtk.Label("Connect to xpra server")
        label.modify_font(pango.FontDescription("sans 13"))
        vbox.pack_start(label)

        # Mode:
        hbox = gtk.HBox(False, 20)
        hbox.set_spacing(20)
        hbox.pack_start(gtk.Label("Mode: "))
        self.mode_combo = gtk.combo_box_new_text()
        self.mode_combo.get_model().clear()
        self.mode_combo.append_text("tcp")
        if not sys.platform.startswith("win"):
            #when we fix the build on win32 to include putty
            #this can be enabled again:
            self.mode_combo.append_text("ssh")
        if xpra_opts.mode == "tcp" or sys.platform.startswith("win"):
            self.mode_combo.set_active(0)
        else:
            self.mode_combo.set_active(1)
        hbox.pack_start(self.mode_combo)
        vbox.pack_start(hbox)

        # Encoding:
        hbox = gtk.HBox(False, 20)
        hbox.set_spacing(20)
        hbox.pack_start(gtk.Label("Encoding: "))
        self.encoding_combo = gtk.combo_box_new_text()
        self.encoding_combo.get_model().clear()
        for option in XPRA_ENCODING_OPTIONS:
            self.encoding_combo.append_text(option)
        self.encoding_combo.set_active(
            XPRA_ENCODING_OPTIONS.index(xpra_opts.encoding))
        hbox.pack_start(self.encoding_combo)
        vbox.pack_start(hbox)

        # JPEG:
        hbox = gtk.HBox(False, 20)
        hbox.set_spacing(20)
        hbox.pack_start(gtk.Label("JPEG Compression: "))
        self.jpeg_combo = gtk.combo_box_new_text()
        self.jpeg_combo.get_model().clear()
        for option in XPRA_COMPRESSION_OPTIONS:
            self.jpeg_combo.append_text(option)
        self.jpeg_combo.set_active(2)
        hbox.pack_start(self.jpeg_combo)
        vbox.pack_start(hbox)

        # Host:Port
        hbox = gtk.HBox(False, 0)
        hbox.set_spacing(5)
        self.host_entry = gtk.Entry(max=128)
        self.host_entry.set_width_chars(40)
        self.host_entry.set_text(xpra_opts.host)
        self.port_entry = gtk.Entry(max=5)
        self.port_entry.set_width_chars(5)
        self.port_entry.set_text(str(xpra_opts.port))
        hbox.pack_start(self.host_entry)
        hbox.pack_start(gtk.Label(":"))
        hbox.pack_start(self.port_entry)
        vbox.pack_start(hbox)

        # Password
        hbox = gtk.HBox(False, 0)
        hbox.set_spacing(20)
        self.password_entry = gtk.Entry(max=128)
        self.password_entry.set_width_chars(30)
        self.password_entry.set_text("")
        self.password_entry.set_visibility(False)
        hbox.pack_start(gtk.Label("Password: "******"Connect")
        self.button.connect("clicked", self.connect_clicked, None)
        vbox.pack_start(self.button)

        self.window.add(vbox)
        self.window.show_all()
예제 #30
0
 def createScreen(self):
     self.loginPage = FirstbootLoginPage()
     self.vbox = gtk.VBox(spacing=5)
     self.vbox.pack_start(self.loginPage.loginPageVbox(), True, True)