Esempio n. 1
0
    def getConnectionPrefs(self):
        '''
        Connection preferences
        '''
        self.optionFrame.set_label(_("Connection Preferences"))

        box = gtk.VBox(False, 3)
        left = gtk.VBox(False, 3)
        right = gtk.VBox(False, 3)
        lr = gtk.HBox(True, 3)
        proxyBox = self.getProxyInfo()

        left.pack_start( gtkutil.createLeftJustifiedLabel(_('Save current username/password/host')), False, False, 0 )
        left.pack_start( gtkutil.createLeftJustifiedLabel(_('Use Proxy')), False, False, 0 )
        left.pack_start( proxyBox, False, False, 0 )

        button = gtk.CheckButton()
        button.set_active( self.optionmanager.get_default_bool_option(OPTION_SAVE_LOGIN, True) )
        button.connect("toggled", self.toggleOption_cb, OPTION_SAVE_LOGIN)
        right.pack_start(button, False, False, 0)

        button = gtk.CheckButton()
        button.set_active( self.optionmanager.get_default_bool_option(OPTION_USE_PROXY, False) )
        button.connect("toggled", self.toggleUseProxy_cb, OPTION_USE_PROXY, proxyBox)
        right.pack_start(button, False, False, 0)

        lr.pack_start(left, False, False, 0)
        lr.pack_start(right, False, False, 0)

        box.pack_start(lr, False, False, 0)
        box.pack_start(self.getAdditionalHosts(), False, False, 0)

        return box
Esempio n. 2
0
    def getProxyInfo(self):
        '''
        Return widgets for setting proxy information
        '''
        p_left = gtk.VBox(True, 3)
        p_right = gtk.VBox(True, 3)
        bbox = gtk.VButtonBox()
        proxyTop = gtk.HBox(False, 3)
        proxyBox = gtk.VBox(False, 3)

        selectedProxyType = self.optionmanager.get_default_option(
            OPTION_PROXY_TYPE, OPTION_PROXY_HTTP)

        p_left.pack_start(gtkutil.createLeftJustifiedLabel(_("Username")),
                          False, False, 0)
        p_left.pack_start(gtkutil.createLeftJustifiedLabel(_('Password')),
                          False, False, 0)
        p_left.pack_start(gtkutil.createLeftJustifiedLabel(_("Host")), False,
                          False, 0)

        for field, tip in ((OPTION_PROXY_USER, None), (OPTION_PROXY_PASSWORD,
                                                       None),
                           (OPTION_PROXY_HOST,
                            _('Value should be <hostname>:<port>'))):
            e = gtk.Entry()
            e.set_text(self.optionmanager.get_default_option(field, ''))
            e.connect("changed", self.entryChanged_cb, field)
            if tip is not None:
                self.tips.set_tip(e, tip)
            p_right.pack_start(e, False, False, 0)

        button = gtk.RadioButton(None, _('HTTP'))
        button.connect("toggled", self.toggleOption_cb, OPTION_PROXY_TYPE,
                       OPTION_PROXY_HTTP)
        button.set_active(selectedProxyType == OPTION_PROXY_HTTP)
        bbox.pack_start(button)
        #button1 = gtk.RadioButton(button, _('SOCKS V4'))
        #button1.connect("toggled", self.toggleOption_cb, OPTION_PROXY_TYPE, OPTION_PROXY_SOCKS4)
        #button1.set_active( selectedProxyType == OPTION_PROXY_SOCKS4)
        #bbox.pack_start(button1)
        #button1 = gtk.RadioButton(button, _('SOCKS V5'))
        ##button1.connect("toggled", self.toggleOption_cb, OPTION_PROXY_TYPE, OPTION_PROXY_SOCKS5)
        #button1.set_active( selectedProxyType == OPTION_PROXY_SOCKS5)
        #bbox.pack_start(button1)

        proxyTop.pack_start(p_left, False, False, 0)
        proxyTop.pack_start(p_right, False, False, 0)

        proxyBox.pack_start(proxyTop, False, False, 0)
        proxyBox.pack_start(bbox, False, False, 0)
        proxyBox.set_sensitive(
            self.optionmanager.get_default_bool_option(OPTION_USE_PROXY,
                                                       False))

        return proxyBox
Esempio n. 3
0
    def getProxyInfo(self):
        '''
        Return widgets for setting proxy information
        '''
        p_left = gtk.VBox(True, 3)
        p_right = gtk.VBox(True, 3)
        bbox = gtk.VButtonBox()
        proxyTop = gtk.HBox(False, 3)
        proxyBox = gtk.VBox(False, 3)

        selectedProxyType = self.optionmanager.get_default_option(OPTION_PROXY_TYPE, OPTION_PROXY_HTTP)

        p_left.pack_start( gtkutil.createLeftJustifiedLabel(_("Username")), False, False, 0 )
        p_left.pack_start( gtkutil.createLeftJustifiedLabel(_('Password')), False, False, 0 )
        p_left.pack_start( gtkutil.createLeftJustifiedLabel(_("Host")), False, False, 0 )

        for field,tip in ( (OPTION_PROXY_USER, None), (OPTION_PROXY_PASSWORD, None), (OPTION_PROXY_HOST, _('Value should be <hostname>:<port>')) ):
            e = gtk.Entry()
            e.set_text( self.optionmanager.get_default_option(field, '') )
            e.connect("changed", self.entryChanged_cb, field)
            if tip is not None:
                self.tips.set_tip(e, tip)
            p_right.pack_start( e, False, False, 0 )

        button = gtk.RadioButton(None, _('HTTP'))
        button.connect("toggled", self.toggleOption_cb, OPTION_PROXY_TYPE, OPTION_PROXY_HTTP)
        button.set_active( selectedProxyType == OPTION_PROXY_HTTP)
        bbox.pack_start(button)
        #button1 = gtk.RadioButton(button, _('SOCKS V4'))
        #button1.connect("toggled", self.toggleOption_cb, OPTION_PROXY_TYPE, OPTION_PROXY_SOCKS4)
        #button1.set_active( selectedProxyType == OPTION_PROXY_SOCKS4)
        #bbox.pack_start(button1)
        #button1 = gtk.RadioButton(button, _('SOCKS V5'))
        ##button1.connect("toggled", self.toggleOption_cb, OPTION_PROXY_TYPE, OPTION_PROXY_SOCKS5)
        #button1.set_active( selectedProxyType == OPTION_PROXY_SOCKS5)
        #bbox.pack_start(button1)

        proxyTop.pack_start(p_left, False, False, 0)
        proxyTop.pack_start(p_right, False, False, 0)

        proxyBox.pack_start(proxyTop, False, False, 0)
        proxyBox.pack_start(bbox, False, False, 0)
        proxyBox.set_sensitive(self.optionmanager.get_default_bool_option(OPTION_USE_PROXY, False))

        return proxyBox
Esempio n. 4
0
    def getConnectionPrefs(self):
        '''
        Connection preferences
        '''
        self.optionFrame.set_label(_("Connection Preferences"))

        box = gtk.VBox(False, 3)
        left = gtk.VBox(False, 3)
        right = gtk.VBox(False, 3)
        lr = gtk.HBox(True, 3)
        proxyBox = self.getProxyInfo()

        left.pack_start(
            gtkutil.createLeftJustifiedLabel(
                _('Save current username/password/host')), False, False, 0)
        left.pack_start(gtkutil.createLeftJustifiedLabel(_('Use Proxy')),
                        False, False, 0)
        left.pack_start(proxyBox, False, False, 0)

        button = gtk.CheckButton()
        button.set_active(
            self.optionmanager.get_default_bool_option(OPTION_SAVE_LOGIN,
                                                       True))
        button.connect("toggled", self.toggleOption_cb, OPTION_SAVE_LOGIN)
        right.pack_start(button, False, False, 0)

        button = gtk.CheckButton()
        button.set_active(
            self.optionmanager.get_default_bool_option(OPTION_USE_PROXY,
                                                       False))
        button.connect("toggled", self.toggleUseProxy_cb, OPTION_USE_PROXY,
                       proxyBox)
        right.pack_start(button, False, False, 0)

        lr.pack_start(left, False, False, 0)
        lr.pack_start(right, False, False, 0)

        box.pack_start(lr, False, False, 0)
        box.pack_start(self.getAdditionalHosts(), False, False, 0)

        return box
Esempio n. 5
0
    def getAdditionalHosts(self):
        '''
        Return additional hosts frame for the connection prefs
        '''
        hostbox = gtk.VBox(False, 3)
        frame = gtk.Frame()
        frame.set_shadow_type(gtk.SHADOW_OUT)

        optionsList = gtk.ListStore(str, str)
        optionsView = gtk.TreeView(optionsList)
        optionsView.set_headers_visible(False)

        col1 = gtk.TreeViewColumn(_('Name'))
        cell1 = gtk.CellRendererText()
        col1.pack_start(cell1, True)
        col1.add_attribute(cell1, 'text', 0)
        optionsView.append_column(col1)

        col2 = gtk.TreeViewColumn(_('Location'))
        cell2 = gtk.CellRendererText()
        col2.pack_start(cell2, True)
        col2.add_attribute(cell2, 'text', 1)
        optionsView.append_column(col2)

        for host, gport, wport, location in util.getAdditionalHosts():
            optionsList.append((host, location))

        frame.add(optionsView)

        hostbuttonbox = gtk.HButtonBox()

        button = gtk.Button(_('Add'))
        button.connect("clicked", self.addHost_cb, optionsList, optionsView)
        hostbuttonbox.add(button)
        button = gtk.Button(_('Remove'))
        button.connect("clicked", self.deleteHost_cb, optionsView)
        hostbuttonbox.add(button)

        hostbox.pack_start(
            gtkutil.createLeftJustifiedLabel(_('Additional Hosts')), False,
            False, 0)
        hostbox.pack_start(frame, False, False, 0)
        hostbox.pack_start(hostbuttonbox, False, False, 0)

        return hostbox
Esempio n. 6
0
    def getAdditionalHosts(self):
        '''
        Return additional hosts frame for the connection prefs
        '''
        hostbox = gtk.VBox(False, 3)
        frame = gtk.Frame()
        frame.set_shadow_type( gtk.SHADOW_OUT )

        optionsList = gtk.ListStore(str,str)
        optionsView = gtk.TreeView( optionsList )
        optionsView.set_headers_visible( False )

        col1 = gtk.TreeViewColumn(_('Name'))
        cell1 = gtk.CellRendererText()
        col1.pack_start(cell1, True)
        col1.add_attribute(cell1, 'text', 0)
        optionsView.append_column( col1 )

        col2 = gtk.TreeViewColumn(_('Location'))
        cell2 = gtk.CellRendererText()
        col2.pack_start(cell2, True)
        col2.add_attribute(cell2, 'text', 1)
        optionsView.append_column( col2 )

        for host,gport,wport,location in util.getAdditionalHosts():
            optionsList.append( (host,location) )

        frame.add( optionsView )

        hostbuttonbox = gtk.HButtonBox()

        button = gtk.Button( _('Add') )
        button.connect("clicked", self.addHost_cb, optionsList, optionsView)
        hostbuttonbox.add( button )
        button = gtk.Button( _('Remove') )
        button.connect("clicked", self.deleteHost_cb, optionsView)
        hostbuttonbox.add( button )

        hostbox.pack_start( gtkutil.createLeftJustifiedLabel(_('Additional Hosts')), False, False, 0)
        hostbox.pack_start(frame, False, False, 0)
        hostbox.pack_start(hostbuttonbox, False, False, 0)

        return hostbox
Esempio n. 7
0
    def getGameplayPrefs(self):
        '''
        Gameplay Preferences
        '''
        self.optionFrame.set_label(_("Gameplay Preferences"))
        box = gtk.VBox(False, 3)

        left = gtk.VBox(True, 3)
        right = gtk.VBox(True, 3)

        left.pack_start(
            gtkutil.createLeftJustifiedLabel(_('Rack re-order method')), False,
            False, 0)
        left.pack_start(
            gtkutil.createLeftJustifiedLabel(
                _('Clear move from board on game error')), False, False, 0)
        left.pack_start(
            gtkutil.createLeftJustifiedLabel(
                _('Show tooltips for premium squares')), False, False, 0)
        left.pack_start(
            gtkutil.createLeftJustifiedLabel(_('Bold letter text')), False,
            False, 0)
        left.pack_start(
            gtkutil.createLeftJustifiedLabel(
                _('Show timestamps in 24-hour format')), False, False, 0)
        left.pack_start(
            gtkutil.createLeftJustifiedLabel(_('Show help at startup')), False,
            False, 0)
        left.pack_start(
            gtkutil.createLeftJustifiedLabel(
                _('Show public servers at startup')), False, False, 0)

        opt = self.optionmanager.get_default_option(OPTION_SWAP,
                                                    OPTION_LETTER_INSERT)
        model = gtk.ListStore(str, str)
        model.append([_('Insert Letters'), OPTION_LETTER_INSERT])
        model.append([_('Swap Letters'), OPTION_LETTER_SWAP])
        cell = gtk.CellRendererText()
        combo = gtk.ComboBox(model)
        combo.pack_start(cell)
        combo.add_attribute(cell, 'text', 0)
        combo.set_active(0)
        combo.connect("changed", self.setComboValue_cb, OPTION_SWAP)
        combo.set_active_iter(gtkutil.getIterByColumn(model, 1, opt))
        right.pack_start(combo, False, False, 0)

        button = gtk.CheckButton()
        button.set_active(
            self.optionmanager.get_default_bool_option(OPTION_CLEAR_ON_ERROR,
                                                       True))
        button.connect("toggled", self.toggleOption_cb, OPTION_CLEAR_ON_ERROR)
        right.pack_start(button, False, False, 0)

        button = gtk.CheckButton()
        button.set_active(
            self.optionmanager.get_default_bool_option(OPTION_ENABLE_T_TIPS,
                                                       True))
        button.connect("toggled", self.toggleOption_cb, OPTION_ENABLE_T_TIPS)
        right.pack_start(button, False, False, 0)

        button = gtk.CheckButton()
        button.set_active(
            self.optionmanager.get_default_bool_option(OPTION_TEXT_BOLD,
                                                       False))
        button.connect("toggled", self.toggleOption_cb, OPTION_TEXT_BOLD)
        right.pack_start(button, False, False, 0)

        button = gtk.CheckButton()
        button.set_active(
            self.optionmanager.get_default_bool_option(OPTION_24_HOUR, False))
        button.connect("toggled", self.toggleOption_cb, OPTION_24_HOUR)
        right.pack_start(button, False, False, 0)

        button = gtk.CheckButton()
        button.set_active(
            self.optionmanager.get_default_bool_option(OPTION_SHOW_TIPS, True))
        button.connect("toggled", self.toggleOption_cb, OPTION_SHOW_TIPS)
        right.pack_start(button, False, False, 0)

        button = gtk.CheckButton()
        button.set_active(
            self.optionmanager.get_default_bool_option(OPTION_SHOW_PS, True))
        button.connect("toggled", self.toggleOption_cb, OPTION_SHOW_PS)
        right.pack_start(button, False, False, 0)

        lr = gtk.HBox(True, 3)
        lr.pack_start(left, False, False, 0)
        lr.pack_start(right, False, False, 0)

        box.pack_start(lr, False, False, 0)

        return box
Esempio n. 8
0
    def getGameplayPrefs(self):
        '''
        Gameplay Preferences
        '''
        self.optionFrame.set_label(_("Gameplay Preferences"))
        box = gtk.VBox(False, 3)

        left = gtk.VBox(True, 3)
        right = gtk.VBox(True, 3)

        left.pack_start( gtkutil.createLeftJustifiedLabel(_('Rack re-order method')), False, False, 0 )
        left.pack_start( gtkutil.createLeftJustifiedLabel(_('Clear move from board on game error')), False, False, 0 )
        left.pack_start( gtkutil.createLeftJustifiedLabel(_('Show tooltips for premium squares')), False, False, 0 )
        left.pack_start( gtkutil.createLeftJustifiedLabel(_('Bold letter text')), False, False, 0 )
        left.pack_start( gtkutil.createLeftJustifiedLabel(_('Show timestamps in 24-hour format')), False, False, 0 )
        left.pack_start( gtkutil.createLeftJustifiedLabel(_('Show help at startup')), False, False, 0 )
        left.pack_start( gtkutil.createLeftJustifiedLabel(_('Show public servers at startup')), False, False, 0 )

        opt = self.optionmanager.get_default_option(OPTION_SWAP, OPTION_LETTER_INSERT)
        model = gtk.ListStore(str,str)
        model.append( [_('Insert Letters'), OPTION_LETTER_INSERT] )
        model.append( [_('Swap Letters'), OPTION_LETTER_SWAP] )
        cell = gtk.CellRendererText()
        combo = gtk.ComboBox(model)
        combo.pack_start(cell)
        combo.add_attribute(cell, 'text', 0)
        combo.set_active(0)
        combo.connect("changed", self.setComboValue_cb, OPTION_SWAP)
        combo.set_active_iter( gtkutil.getIterByColumn(model, 1, opt))
        right.pack_start(combo, False, False, 0)

        button = gtk.CheckButton()
        button.set_active( self.optionmanager.get_default_bool_option(OPTION_CLEAR_ON_ERROR, True) )
        button.connect("toggled", self.toggleOption_cb, OPTION_CLEAR_ON_ERROR)
        right.pack_start(button, False, False, 0)

        button = gtk.CheckButton()
        button.set_active( self.optionmanager.get_default_bool_option(OPTION_ENABLE_T_TIPS, True) )
        button.connect("toggled", self.toggleOption_cb, OPTION_ENABLE_T_TIPS)
        right.pack_start(button, False, False, 0)

        button = gtk.CheckButton()
        button.set_active( self.optionmanager.get_default_bool_option(OPTION_TEXT_BOLD, False) )
        button.connect("toggled", self.toggleOption_cb, OPTION_TEXT_BOLD)
        right.pack_start(button, False, False, 0)

        button = gtk.CheckButton()
        button.set_active( self.optionmanager.get_default_bool_option(OPTION_24_HOUR, False) )
        button.connect("toggled", self.toggleOption_cb, OPTION_24_HOUR)
        right.pack_start(button, False, False, 0)

        button = gtk.CheckButton()
        button.set_active( self.optionmanager.get_default_bool_option(OPTION_SHOW_TIPS, True) )
        button.connect("toggled", self.toggleOption_cb, OPTION_SHOW_TIPS)
        right.pack_start(button, False, False, 0)

        button = gtk.CheckButton()
        button.set_active( self.optionmanager.get_default_bool_option(OPTION_SHOW_PS, True) )
        button.connect("toggled", self.toggleOption_cb, OPTION_SHOW_PS)
        right.pack_start(button, False, False, 0)

        lr = gtk.HBox(True, 3)
        lr.pack_start(left, False, False, 0)
        lr.pack_start(right, False, False, 0)

        box.pack_start(lr, False, False, 0)

        return box