Пример #1
0
    def __init__(self, url, username, password):
        KDialog.__init__(self)
        decorateWindow(self, i18n('Create User Account'))
        self.setButtons(KDialog.ButtonCode(KDialog.Ok | KDialog.Cancel))
        vbox = QVBoxLayout()
        grid = QFormLayout()
        self.lbServer = QLabel()
        self.lbServer.setText(url)
        grid.addRow(i18n('Game server:'), self.lbServer)
        self.lbUser = QLabel()
        grid.addRow(i18n('Username:'******'Password:'******'Repeat password:'), self.edPassword2)
        vbox.addLayout(grid)
        widget = QWidget(self)
        widget.setLayout(vbox)
        self.setMainWidget(widget)
        pol = QSizePolicy()
        pol.setHorizontalPolicy(QSizePolicy.Expanding)
        self.lbUser.setSizePolicy(pol)

        self.edPassword.textChanged.connect(self.passwordChanged)
        self.edPassword2.textChanged.connect(self.passwordChanged)
        StateSaver(self)
        self.username = username
        self.password = password
        self.passwordChanged()
        self.edPassword2.setFocus()
Пример #2
0
 def setupUi(self):
     """create all Ui elements but do not fill them"""
     self.buttonBox = KDialogButtonBox(self)
     self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel
                                       | QDialogButtonBox.Ok)
     # Ubuntu 11.10 unity is a bit strange - without this, it sets focus on
     # the cancel button (which it shows on the left). I found no obvious
     # way to use setDefault and setAutoDefault for fixing this.
     self.buttonBox.button(QDialogButtonBox.Ok).setFocus(True)
     self.buttonBox.accepted.connect(self.accept)
     self.buttonBox.rejected.connect(self.reject)
     vbox = QVBoxLayout(self)
     self.grid = QFormLayout()
     self.cbServer = QComboBox()
     self.cbServer.setEditable(True)
     self.grid.addRow(i18n('Game server:'), self.cbServer)
     self.cbUser = QComboBox()
     self.cbUser.setEditable(True)
     self.grid.addRow(i18n('Username:'******'Password:'******'kajongg', 'Ruleset:'), self.cbRuleset)
     vbox.addLayout(self.grid)
     vbox.addWidget(self.buttonBox)
     pol = QSizePolicy()
     pol.setHorizontalPolicy(QSizePolicy.Expanding)
     self.cbUser.setSizePolicy(pol)
     self.__port = None
Пример #3
0
 def setupUILastTileMeld(self, pGrid):
     """setup UI elements for last tile and last meld"""
     self.lblLastTile = QLabel(i18n('&Last Tile:'))
     self.cbLastTile = QComboBox()
     self.cbLastTile.setMinimumContentsLength(1)
     vpol = QSizePolicy()
     vpol.setHorizontalPolicy(QSizePolicy.Fixed)
     self.cbLastTile.setSizePolicy(vpol)
     self.cbLastTile.setSizeAdjustPolicy(
         QComboBox.AdjustToMinimumContentsLengthWithIcon)
     self.lblLastTile.setBuddy(self.cbLastTile)
     self.lblLastMeld = QLabel(i18n('L&ast Meld:'))
     self.prevLastTile = None
     self.cbLastMeld = QComboBox()
     self.cbLastMeld.setMinimumContentsLength(1)
     self.cbLastMeld.setSizePolicy(vpol)
     self.cbLastMeld.setSizeAdjustPolicy(
         QComboBox.AdjustToMinimumContentsLengthWithIcon)
     self.lblLastMeld.setBuddy(self.cbLastMeld)
     self.comboTilePairs = set()
     pGrid.setRowStretch(6, 5)
     pGrid.addWidget(self.lblLastTile, 7, 0, 1, 2)
     pGrid.addWidget(self.cbLastTile, 7, 2, 1, 1)
     pGrid.addWidget(self.lblLastMeld, 8, 0, 1, 2)
     pGrid.addWidget(self.cbLastMeld, 8, 2, 1, 2)
Пример #4
0
 def __init__(self, parent=None):
     """generate a fitting view with our favourite properties"""
     QGraphicsView.__init__(self, parent)
     self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
     self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
     vpol = QSizePolicy()
     vpol.setHorizontalPolicy(QSizePolicy.Expanding)
     vpol.setVerticalPolicy(QSizePolicy.Expanding)
     self.setSizePolicy(vpol)
     self.setRenderHint(QPainter.Antialiasing)
     self.setRenderHint(QPainter.SmoothPixmapTransform)
     self.setStyleSheet('background: transparent')
     self.setFrameStyle(QFrame.NoFrame)
     self.tilePressed = None
     self.dragObject = None
     self.setFocus()
Пример #5
0
 def setupUi(self):
     """layout the window"""
     self.setContentsMargins(0, 0, 0, 0)
     vlayout = QVBoxLayout(self)
     vlayout.setContentsMargins(0, 0, 0, 0)
     sliderLayout = QHBoxLayout()
     self.kcfg_showShadows = QCheckBox(m18n('Show tile shadows'), self)
     self.kcfg_showShadows.setObjectName('kcfg_showShadows')
     self.kcfg_rearrangeMelds = QCheckBox(
         m18n('Rearrange undisclosed tiles to melds'), self)
     self.kcfg_rearrangeMelds.setObjectName('kcfg_rearrangeMelds')
     self.kcfg_showOnlyPossibleActions = QCheckBox(m18n(
         'Show only possible actions'))
     self.kcfg_showOnlyPossibleActions.setObjectName(
         'kcfg_showOnlyPossibleActions')
     self.kcfg_propose = QCheckBox(m18n('Propose what to do'))
     self.kcfg_propose.setObjectName('kcfg_propose')
     self.kcfg_animationSpeed = QSlider(self)
     self.kcfg_animationSpeed.setObjectName('kcfg_animationSpeed')
     self.kcfg_animationSpeed.setOrientation(Qt.Horizontal)
     self.kcfg_animationSpeed.setSingleStep(1)
     lblSpeed = QLabel(m18n('Animation speed:'))
     lblSpeed.setBuddy(self.kcfg_animationSpeed)
     sliderLayout.addWidget(lblSpeed)
     sliderLayout.addWidget(self.kcfg_animationSpeed)
     self.kcfg_useSounds = QCheckBox(m18n('Use sounds if available'), self)
     self.kcfg_useSounds.setObjectName('kcfg_useSounds')
     self.kcfg_uploadVoice = QCheckBox(m18n(
         'Let others hear my voice'), self)
     self.kcfg_uploadVoice.setObjectName('kcfg_uploadVoice')
     pol = QSizePolicy()
     pol.setHorizontalPolicy(QSizePolicy.Expanding)
     pol.setVerticalPolicy(QSizePolicy.Expanding)
     spacerItem = QSpacerItem(
         20, 20, QSizePolicy.Minimum, QSizePolicy.Expanding)
     vlayout.addWidget(self.kcfg_showShadows)
     vlayout.addWidget(self.kcfg_rearrangeMelds)
     vlayout.addWidget(self.kcfg_showOnlyPossibleActions)
     vlayout.addWidget(self.kcfg_propose)
     vlayout.addWidget(self.kcfg_useSounds)
     vlayout.addWidget(self.kcfg_uploadVoice)
     vlayout.addLayout(sliderLayout)
     vlayout.addItem(spacerItem)
     self.setSizePolicy(pol)
     self.retranslateUi()
Пример #6
0
 def setupUILastTileMeld(self, pGrid):
     """setup UI elements for last tile and last meld"""
     self.lblLastTile = QLabel(m18n("&Last Tile:"))
     self.cbLastTile = QComboBox()
     self.cbLastTile.setMinimumContentsLength(1)
     vpol = QSizePolicy()
     vpol.setHorizontalPolicy(QSizePolicy.Fixed)
     self.cbLastTile.setSizePolicy(vpol)
     self.cbLastTile.setSizeAdjustPolicy(QComboBox.AdjustToMinimumContentsLengthWithIcon)
     self.lblLastTile.setBuddy(self.cbLastTile)
     self.lblLastMeld = QLabel(m18n("L&ast Meld:"))
     self.prevLastTile = None
     self.cbLastMeld = QComboBox()
     self.cbLastMeld.setMinimumContentsLength(1)
     self.cbLastMeld.setSizePolicy(vpol)
     self.cbLastMeld.setSizeAdjustPolicy(QComboBox.AdjustToMinimumContentsLengthWithIcon)
     self.lblLastMeld.setBuddy(self.cbLastMeld)
     self.comboTilePairs = set()
     pGrid.setRowStretch(6, 5)
     pGrid.addWidget(self.lblLastTile, 7, 0, 1, 2)
     pGrid.addWidget(self.cbLastTile, 7, 2, 1, 1)
     pGrid.addWidget(self.lblLastMeld, 8, 0, 1, 2)
     pGrid.addWidget(self.cbLastMeld, 8, 2, 1, 2)
Пример #7
0
 def __init__(self, parent=None):
     QTableView.__init__(self, parent)
     self.horizontalHeader().setStretchLastSection(True)
     self.setAlternatingRowColors(True)
     pol = QSizePolicy()
     pol.setHorizontalPolicy(QSizePolicy.Expanding)
     pol.setVerticalPolicy(QSizePolicy.Expanding)
     self.setSizePolicy(pol)
     self.verticalHeader().hide()
Пример #8
0
 def __init__(self, parent=None):
     """generate a fitting view with our favourite properties"""
     QGraphicsView.__init__(self, parent)
     self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
     self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
     vpol = QSizePolicy()
     vpol.setHorizontalPolicy(QSizePolicy.Expanding)
     vpol.setVerticalPolicy(QSizePolicy.Expanding)
     self.setSizePolicy(vpol)
     self.setRenderHint(QPainter.Antialiasing)
     self.setRenderHint(QPainter.SmoothPixmapTransform)
     self.setStyleSheet('background: transparent')
     self.setFrameStyle(QFrame.NoFrame)
     self.tilePressed = None
     self.dragObject = None
     self.setFocus()
Пример #9
0
 def setupUi(self):
     """layout the window"""
     self.setContentsMargins(0, 0, 0, 0)
     vlayout = QVBoxLayout(self)
     vlayout.setContentsMargins(0, 0, 0, 0)
     sliderLayout = QHBoxLayout()
     self.kcfg_showShadows = QCheckBox(i18n('Show tile shadows'), self)
     self.kcfg_showShadows.setObjectName('kcfg_showShadows')
     self.kcfg_rearrangeMelds = QCheckBox(
         i18n('Rearrange undisclosed tiles to melds'), self)
     self.kcfg_rearrangeMelds.setObjectName('kcfg_rearrangeMelds')
     self.kcfg_showOnlyPossibleActions = QCheckBox(
         i18n('Show only possible actions'))
     self.kcfg_showOnlyPossibleActions.setObjectName(
         'kcfg_showOnlyPossibleActions')
     self.kcfg_propose = QCheckBox(i18n('Propose what to do'))
     self.kcfg_propose.setObjectName('kcfg_propose')
     self.kcfg_animationSpeed = QSlider(self)
     self.kcfg_animationSpeed.setObjectName('kcfg_animationSpeed')
     self.kcfg_animationSpeed.setOrientation(Qt.Horizontal)
     self.kcfg_animationSpeed.setSingleStep(1)
     lblSpeed = QLabel(i18n('Animation speed:'))
     lblSpeed.setBuddy(self.kcfg_animationSpeed)
     sliderLayout.addWidget(lblSpeed)
     sliderLayout.addWidget(self.kcfg_animationSpeed)
     self.kcfg_useSounds = QCheckBox(i18n('Use sounds if available'), self)
     self.kcfg_useSounds.setObjectName('kcfg_useSounds')
     self.kcfg_uploadVoice = QCheckBox(i18n('Let others hear my voice'),
                                       self)
     self.kcfg_uploadVoice.setObjectName('kcfg_uploadVoice')
     pol = QSizePolicy()
     pol.setHorizontalPolicy(QSizePolicy.Expanding)
     pol.setVerticalPolicy(QSizePolicy.Expanding)
     spacerItem = QSpacerItem(20, 20, QSizePolicy.Minimum,
                              QSizePolicy.Expanding)
     vlayout.addWidget(self.kcfg_showShadows)
     vlayout.addWidget(self.kcfg_rearrangeMelds)
     vlayout.addWidget(self.kcfg_showOnlyPossibleActions)
     vlayout.addWidget(self.kcfg_propose)
     vlayout.addWidget(self.kcfg_useSounds)
     vlayout.addWidget(self.kcfg_uploadVoice)
     vlayout.addLayout(sliderLayout)
     vlayout.addItem(spacerItem)
     self.setSizePolicy(pol)
     self.retranslateUi()