def loadData(self): """loads all data from the data base into a 2D matrix formatted like the wanted tree""" game = self.scoreTable.game data = [] records = Query( 'select player,rotated,notrotated,penalty,won,prevailing,wind,points,payments,balance,manualrules' ' from score where game=? order by player,hand', (game.gameid, )).records humans = sorted( (x for x in game.players if not x.name.startswith('Robot'))) robots = sorted( (x for x in game.players if x.name.startswith('Robot'))) data = list( tuple([ player.localName, [HandResult(*x[1:]) for x in records if x[0] == player.nameid] ]) for player in humans + robots) self.__findMinMaxChartPoints(data) parent = QModelIndex() groupIndex = self.index(self.rootItem.childCount(), 0, parent) groupNames = [ i18nc('kajongg', 'Score'), i18nc('kajongg', 'Payments'), i18nc('kajongg', 'Balance'), i18nc('kajongg', 'Chart') ] for idx, groupName in enumerate(groupNames): self.insertRows(idx, list([ScoreGroupItem(groupName)]), groupIndex) listIndex = self.index(idx, 0, groupIndex) for idx1, item in enumerate(data): self.insertRows(idx1, list([ScorePlayerItem(item)]), listIndex)
def penaltyChanged(self): """total has changed, update payments""" # normally value is only validated when leaving the field self.spPenalty.interpretText() offense = self.cbCrime.current penalty = self.spPenalty.value() payers = int(offense.options.get('payers', 1)) payees = int(offense.options.get('payees', 1)) payerAmount = -penalty // payers payeeAmount = penalty // payees for pList, amount, count in ((self.payers, payerAmount, payers), (self.payees, payeeAmount, payees)): for idx, player in enumerate(pList): player.setVisible(idx < count) player.lblPayment.setVisible(idx < count) if idx < count: if pList == self.payers: player.lblPayment.setText( i18nc( 'penalty dialog, appears behind paying player combobox', 'pays %1 points', -amount)) else: player.lblPayment.setText( i18nc( 'penalty dialog, appears behind profiting player combobox', 'gets %1 points', amount))
def __init__(self): """self.servers is a list of tuples containing server and last playername""" QDialog.__init__(self, None) decorateWindow(self, i18nc('kajongg', 'Login')) self.setupUi() localName = i18nc('kajongg name for local game server', Query.localServerName) self.servers = Query( 'select url,lastname from server order by lasttime desc').records servers = list(x[0] for x in self.servers if x[0] != Query.localServerName) # the first server combobox item should be default: either the last used server # or localName for autoPlay if localName not in servers: servers.append(localName) if 'kajongg.org' not in servers: servers.append('kajongg.org') if Internal.autoPlay: demoHost = Options.host or localName if demoHost in servers: servers.remove( demoHost ) # we want a unique list, it will be re-used for all following games servers.insert(0, demoHost) # in this process but they will not be autoPlay self.cbServer.addItems(servers) self.passwords = Query( 'select url, p.name, passwords.password from passwords, player p ' 'where passwords.player=p.id').records Players.load() self.cbServer.editTextChanged.connect(self.serverChanged) self.cbUser.editTextChanged.connect(self.userChanged) self.serverChanged() StateSaver(self)
def __stateName(self): """the translated name of the state""" if self.isBonus or self.isClaimedKong: return '' elif self.isExposed: return i18nc('kajongg meld state', 'Exposed') else: return i18nc('kajongg meld state', 'Concealed')
def __init__(self, client): super(TableList, self).__init__(None) self.autoStarted = False self.client = client self.setObjectName('TableList') self.resize(700, 400) self.view = MJTableView(self) self.differ = None self.debugModelTest = None self.requestedNewTable = False self.view.setItemDelegateForColumn(2, RichTextColumnDelegate(self.view)) buttonBox = QDialogButtonBox(self) self.newButton = buttonBox.addButton( i18nc('allocate a new table', "&New"), QDialogButtonBox.ActionRole) self.newButton.setIcon(KIcon("document-new")) self.newButton.setToolTip(i18n("Allocate a new table")) self.newButton.clicked.connect(self.client.newTable) self.joinButton = buttonBox.addButton(i18n("&Join"), QDialogButtonBox.AcceptRole) self.joinButton.clicked.connect(client.joinTable) self.joinButton.setIcon(KIcon("list-add-user")) self.joinButton.setToolTip(i18n("Join a table")) self.leaveButton = buttonBox.addButton(i18n("&Leave"), QDialogButtonBox.AcceptRole) self.leaveButton.clicked.connect(self.leaveTable) self.leaveButton.setIcon(KIcon("list-remove-user")) self.leaveButton.setToolTip(i18n("Leave a table")) self.compareButton = buttonBox.addButton( i18nc('Kajongg-Ruleset', 'Compare'), QDialogButtonBox.AcceptRole) self.compareButton.clicked.connect(self.compareRuleset) self.compareButton.setIcon(KIcon("preferences-plugin-script")) self.compareButton.setToolTip( i18n('Compare the rules of this table with my own rulesets')) self.chatButton = buttonBox.addButton(i18n('&Chat'), QDialogButtonBox.AcceptRole) self.chatButton.setIcon(KIcon("call-start")) self.chatButton.clicked.connect(self.chat) self.startButton = buttonBox.addButton(i18n('&Start'), QDialogButtonBox.AcceptRole) self.startButton.clicked.connect(self.startGame) self.startButton.setIcon(KIcon("arrow-right")) self.startButton.setToolTip( i18n("Start playing on a table. " "Empty seats will be taken by robot players.")) cmdLayout = QHBoxLayout() cmdLayout.addWidget(buttonBox) layout = QVBoxLayout() layout.addWidget(self.view) layout.addLayout(cmdLayout) self.setLayout(layout) self.view.doubleClicked.connect(client.joinTable) StateSaver(self, self.view.horizontalHeader()) self.updateButtonsForTable(None)
def status(self): """a status string""" result = '' if self.suspendedAt: result = i18nc('table status', 'Suspended') result += ' ' + datetime.datetime.strptime( self.suspendedAt, '%Y-%m-%dT%H:%M:%S').strftime('%c') if self.running: result += ' ' + i18nc('table status', 'Running') return result or i18nc('table status', 'New')
def i18nStr(self): """make score readable for humans, i18n""" parts = [] if self.points: parts.append(i18nc('Kajongg', '%1 points', self.points)) if self.doubles: parts.append(i18nc('Kajongg', '%1 doubles', self.doubles)) if self.limits: limits = str(self.limits) if limits.endswith('.0'): limits = limits[-2:] parts.append(i18nc('Kajongg', '%1 limits', limits)) return ' '.join(parts)
def __init__(self, parent=None): super(Games, self).__init__(parent) self.selectedGame = None self.onlyPending = True decorateWindow(self, i18nc('kajongg', 'Games')) self.setObjectName('Games') self.resize(700, 400) self.model = GamesModel() if Debug.modelTest: self.modelTest = ModelTest(self.model, self) self.view = MJTableView(self) self.view.setModel(self.model) self.selection = QItemSelectionModel(self.model, self.view) self.view.setSelectionModel(self.selection) self.view.setSelectionBehavior(QAbstractItemView.SelectRows) self.view.setSelectionMode(QAbstractItemView.SingleSelection) self.buttonBox = QDialogButtonBox(self) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel) self.newButton = self.buttonBox.addButton( i18nc('start a new game', "&New"), QDialogButtonBox.ActionRole) self.newButton.setIcon(KIcon("document-new")) self.newButton.clicked.connect(self.accept) self.loadButton = self.buttonBox.addButton( i18n("&Load"), QDialogButtonBox.AcceptRole) self.loadButton.clicked.connect(self.loadGame) self.loadButton.setIcon(KIcon("document-open")) self.deleteButton = self.buttonBox.addButton( i18n("&Delete"), QDialogButtonBox.ActionRole) self.deleteButton.setIcon(KIcon("edit-delete")) self.deleteButton.clicked.connect(self.delete) chkPending = QCheckBox(i18n("Show only pending games"), self) chkPending.setChecked(True) cmdLayout = QHBoxLayout() cmdLayout.addWidget(chkPending) cmdLayout.addWidget(self.buttonBox) layout = QVBoxLayout() layout.addWidget(self.view) layout.addLayout(cmdLayout) self.setLayout(layout) StateSaver(self) self.selection.selectionChanged.connect(self.selectionChanged) self.buttonBox.accepted.connect(self.accept) self.buttonBox.rejected.connect(self.reject) self.view.doubleClicked.connect(self.loadGame) chkPending.stateChanged.connect(self.pendingOrNot)
def setupUi(self): """setup UI elements""" self.viewLeft = ScoreViewLeft(self) self.viewRight = ScoreViewRight(self) self.viewRight.setHorizontalScrollBar(HorizontalScrollBar(self)) self.viewRight.setHorizontalScrollMode(QAbstractItemView.ScrollPerItem) self.viewRight.setFocusPolicy(Qt.NoFocus) self.viewRight.header().setSectionsClickable(False) self.viewRight.header().setSectionsMovable(False) self.viewRight.setSelectionMode(QAbstractItemView.NoSelection) windowLayout = QVBoxLayout(self) self.splitter = QSplitter(Qt.Vertical) self.splitter.setObjectName('ScoreTableSplitter') windowLayout.addWidget(self.splitter) scoreWidget = QWidget() self.scoreLayout = QHBoxLayout(scoreWidget) leftLayout = QVBoxLayout() leftLayout.addWidget(self.viewLeft) self.leftLayout = leftLayout self.scoreLayout.addLayout(leftLayout) self.scoreLayout.addWidget(self.viewRight) self.splitter.addWidget(scoreWidget) self.ruleTree = RuleTreeView(i18nc('kajongg', 'Used Rules')) self.splitter.addWidget(self.ruleTree) # this shows just one line for the ruleTree - so we just see the # name of the ruleset: self.splitter.setSizes(list([1000, 1]))
def name(self): """the long name""" result = i18nc('kajongg meld name, do not translate parameter names', '{state} {meldType} {name}') return result.format(state=self.__stateName(), meldType=self.typeName(), name=self[0].name()).replace(' ', ' ').strip()
def __navigateScoringGame(self, event): """keyboard navigation in a scoring game""" mod = event.modifiers() key = event.key() wind = chr(key % 128) windsX = ''.join(x.char for x in Wind.all) moveCommands = i18nc( 'kajongg:keyboard commands for moving tiles to the players ' 'with wind ESWN or to the central tile selector (X)', windsX) uiTile = self.focusItem() if wind in moveCommands: # translate i18n wind key to ESWN: wind = windsX[moveCommands.index(wind)] self.__moveTile(uiTile, wind, bool(mod & Qt.ShiftModifier)) return True if key == Qt.Key_Tab and self.game: tabItems = [self.selectorBoard] tabItems.extend( list(p.handBoard for p in self.game.players if p.handBoard.uiTiles)) tabItems.append(tabItems[0]) currentBoard = uiTile.board currIdx = 0 while tabItems[currIdx] != currentBoard and currIdx < len( tabItems) - 2: currIdx += 1 tabItems[currIdx + 1].hasFocus = True return True
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
def __init__(self, parent): QDialog.__init__(self) self.parent = parent self._data = {} self.table = QTableWidget(self) self.table.horizontalHeader().setStretchLastSection(True) self.table.verticalHeader().setVisible(False) self.table.setEditTriggers(QTableWidget.NoEditTriggers) self.table.itemChanged.connect(self.itemChanged) self.updateTable() self.buttonBox = QDialogButtonBox() self.buttonBox.setStandardButtons( QDialogButtonBox.Close) # Close has the Rejected role self.buttonBox.rejected.connect(self.accept) self.newButton = self.buttonBox.addButton( i18nc('define a new player', "&New"), QDialogButtonBox.ActionRole) self.newButton.setIcon(KIcon("document-new")) self.newButton.clicked.connect(self.slotInsert) self.deleteButton = self.buttonBox.addButton( i18n("&Delete"), QDialogButtonBox.ActionRole) self.deleteButton.setIcon(KIcon("edit-delete")) self.deleteButton.clicked.connect(self.delete) cmdLayout = QHBoxLayout() cmdLayout.addWidget(self.buttonBox) layout = QVBoxLayout() layout.addWidget(self.table) layout.addLayout(cmdLayout) self.setLayout(layout) decorateWindow(self, i18n("Players")) self.setObjectName('Players')
def headerData( # pylint: disable=no-self-use self, section, orientation, role=Qt.DisplayRole): """show header""" if role == Qt.TextAlignmentRole: if orientation == Qt.Horizontal: if section in [3, 4]: return int(Qt.AlignLeft) else: return int(Qt.AlignHCenter | Qt.AlignVCenter) if role != Qt.DisplayRole: return if orientation != Qt.Horizontal: return int(section + 1) result = '' if section < 5: result = [ i18n('Table'), '', i18n('Players'), i18nc('table status', 'Status'), i18n('Ruleset') ][section] return result
def popupMsg(self, msg): """shows a yellow message from player""" if msg != Message.NoClaim: self.speak(msg.name.lower()) yellow = self.front.message yellow.setText('{} {}'.format(yellow.msg, i18nc('kajongg', msg.name))) yellow.setVisible(True)
def formattedDiffs(self): """a list of tuples with 3 values: name, left, right""" formatted = [] leftRuleset = self.cbRuleset1.current rightRuleset = self.cbRuleset2.current assert rightRuleset, self.cbRuleset2.count() leftRuleset.load() rightRuleset.load() for rule1, rule2 in leftRuleset.diff(rightRuleset): name = i18n(rule1.name if rule1 else rule2.name) left = rule1.i18nStr() if rule1 else i18nc( 'Kajongg-Rule', 'not defined') right = rule2.i18nStr() if rule2 else i18nc( 'Kajongg-Rule', 'not defined') formatted.append((name, left, right)) if rule1 and rule2 and rule1.definition != rule2.definition: formatted.append(('', rule1.definition, rule2.definition)) return formatted
def validate(self): """check for validity""" payers = int(self.options.get('payers', 1)) payees = int(self.options.get('payees', 1)) if not 2 <= payers + payees <= 4: logException( i18nc('%1 can be a sentence', '%4 have impossible values %2/%3 in rule "%1"', self.name, payers, payees, 'payers/payees'))
def __init__(self, name): """name may be: - an integer: ruleset.id from the sql table - a list: the full ruleset specification (probably sent from the server) - a string: The hash value of a ruleset""" Rule.importRulecode() self.name = name self.rulesetId = 0 self.__hash = None self.allRules = [] self.__dirty = False # only the ruleset editor is supposed to make us dirty self.__loaded = False self.__filteredLists = {} self.description = None self.rawRules = None # used when we get the rules over the network self.doublingMeldRules = [] self.doublingHandRules = [] self.standardMJRule = None self.meldRules = RuleList( 1, i18n('Meld Rules'), i18n( 'Meld rules are applied to single melds independent of the rest of the hand' )) self.handRules = RuleList( 2, i18n('Hand Rules'), i18n('Hand rules are applied to the entire hand, for all players')) self.winnerRules = RuleList( 3, i18n('Winner Rules'), i18n( 'Winner rules are applied to the entire hand but only for the winner' )) self.loserRules = RuleList( 33, i18n('Loser Rules'), i18n( 'Loser rules are applied to the entire hand but only for non-winners' )) self.mjRules = RuleList( 4, i18n('Mah Jongg Rules'), i18n('Only hands matching a Mah Jongg rule can win')) self.parameterRules = RuleList( 999, i18nc('kajongg', 'Options'), i18n('Here we have several special game related options')) self.penaltyRules = RuleList( 9999, i18n('Penalties'), i18n( """Penalties are applied manually by the user. They are only used for scoring games. When playing against the computer or over the net, Kajongg will never let you get into a situation where you have to pay a penalty""")) self.ruleLists = list([ self.meldRules, self.handRules, self.mjRules, self.winnerRules, self.loserRules, self.parameterRules, self.penaltyRules ]) # the order of ruleLists is the order in which the lists appear in the ruleset editor # if you ever want to remove an entry from ruleLists: make sure its listId is not reused or you get # in trouble when updating self._initRuleset()
def __init__(self, scene): QWidget.__init__(self) self.scene = scene decorateWindow(self, i18n('Scoring for this Hand')) self.nameLabels = [None] * 4 self.spValues = [None] * 4 self.windLabels = [None] * 4 self.wonBoxes = [None] * 4 self.detailsLayout = [None] * 4 self.details = [None] * 4 self.__tilePixMaps = [] self.__meldPixMaps = [] grid = QGridLayout(self) pGrid = QGridLayout() grid.addLayout(pGrid, 0, 0, 2, 1) pGrid.addWidget(QLabel(i18nc('kajongg', "Player")), 0, 0) pGrid.addWidget(QLabel(i18nc('kajongg', "Wind")), 0, 1) pGrid.addWidget(QLabel(i18nc('kajongg', 'Score')), 0, 2) pGrid.addWidget(QLabel(i18n("Winner")), 0, 3) self.detailTabs = QTabWidget() self.detailTabs.setDocumentMode(True) pGrid.addWidget(self.detailTabs, 0, 4, 8, 1) for idx in range(4): self.setupUiForPlayer(pGrid, idx) self.draw = QCheckBox(i18nc('kajongg', 'Draw')) self.draw.clicked.connect(self.wonChanged) btnPenalties = QPushButton(i18n("&Penalties")) btnPenalties.clicked.connect(self.penalty) self.btnSave = QPushButton(i18n('&Save Hand')) self.btnSave.clicked.connect(self.game.nextScoringHand) self.btnSave.setEnabled(False) self.setupUILastTileMeld(pGrid) pGrid.setRowStretch(87, 10) pGrid.addWidget(self.draw, 7, 3) self.cbLastTile.currentIndexChanged.connect(self.slotLastTile) self.cbLastMeld.currentIndexChanged.connect(self.slotInputChanged) btnBox = QHBoxLayout() btnBox.addWidget(btnPenalties) btnBox.addWidget(self.btnSave) pGrid.addLayout(btnBox, 8, 4) StateSaver(self) self.refresh()
def groupName(self): """the name of the group this tile is of""" names = { Tile.hidden: i18nc('kajongg', 'hidden'), Tile.stone: i18nc('kajongg', 'stone'), Tile.bamboo: i18nc('kajongg', 'bamboo'), Tile.character: i18nc('kajongg', 'character'), Tile.wind: i18nc('kajongg', 'wind'), Tile.dragon: i18nc('kajongg', 'dragon'), Tile.flower: i18nc('kajongg', 'flower'), Tile.season: i18nc('kajongg', 'season') } return names[self.lowerGroup]
def __init__(self, parent, name): # pylint: disable=super-init-not-called KConfigDialog.__init__(self, parent, name, Internal.Preferences) StateSaver(self) self.pages = [ self.addPage(PlayConfigTab(self), i18nc('kajongg', 'Play'), "arrow-right"), self.addPage(TilesetSelector(self), i18n("Tiles"), "games-config-tiles"), self.addPage(BackgroundSelector(self), i18n("Backgrounds"), "games-config-background") ]
def name(self): """returns name of a single tile""" if self.group.lower() == Tile.wind: result = { East: i18n('East Wind'), South: i18n('South Wind'), West: i18n('West Wind'), North: i18n('North Wind') }[self.value] else: result = i18nc('kajongg tile name', '{group} {value}') return result.format(value=self.valueName(), group=self.groupName())
def mapChar2Arrow(event): """maps the keys hjkl to arrows like in vi and konqueror""" key = event.key() if key in Board.arrows: return key charArrows = i18nc( 'kajongg:arrow keys hjkl like in konqueror', 'hjklHJKL') key = event.text() if key and key in charArrows: key = Board.arrows[charArrows.index(key) % 4] return key
def data(self, index, role=Qt.DisplayRole): """score table""" # pylint: disable=too-many-branches,too-many-locals,redefined-variable-type result = None if role == Qt.TextAlignmentRole: if index.column() == 0: result = int(Qt.AlignHCenter | Qt.AlignVCenter) else: result = int(Qt.AlignLeft | Qt.AlignVCenter) if index.isValid() and (0 <= index.row() < len(self.tables)): table = self.tables[index.row()] if role == Qt.DisplayRole and index.column() in (0, 1): result = table.tableid elif role == Qt.DisplayRole and index.column() == 2: players = [] zipped = list(zip(table.playerNames, table.playersOnline)) for idx, pair in enumerate(zipped): name, online = pair[0], pair[1] if idx < len(zipped) - 1: name += ', ' palette = KApplication.palette() if online: color = palette.color(QPalette.Active, QPalette.WindowText).name() style = ('font-weight:normal;' 'font-style:normal;color:%s' % color) else: color = palette.color(QPalette.Disabled, QPalette.WindowText).name() style = ('font-weight:100;font-style:italic;color:%s' % color) players.append('<nobr style="%s">' % style + name + '</nobr>') names = ''.join(players) result = names elif role == Qt.DisplayRole and index.column() == 3: status = table.status() if table.suspendedAt: dateVal = ' ' + datetime.datetime.strptime( table.suspendedAt, '%Y-%m-%dT%H:%M:%S').strftime('%c') status = 'Suspended' else: dateVal = '' result = i18nc('table status', status) + dateVal elif index.column() == 4: if role == Qt.DisplayRole: result = i18n((table.myRuleset if table.myRuleset else table.ruleset).name) elif role == Qt.ForegroundRole: palette = KApplication.palette() color = palette.windowText() if table.myRuleset else 'red' result = QColor(color) return result
def _newKey(self, minus=False): """generate a new id and a new name if the name already exists""" newId = self.newId(minus=minus) newName = self.name if minus: copyNr = 1 while self.nameExists(newName): copyStr = ' ' + str(copyNr) if copyNr > 1 else '' newName = i18nc( 'Ruleset._newKey:%1 is empty or space plus number', 'Copy%1 of %2', copyStr, i18n(self.name)) copyNr += 1 return newId, newName
def valueName(self): """the name of the value this tile has""" names = { 'y': i18nc('kajongg', 'tile'), Tile.white: i18nc('kajongg', 'white'), Tile.red: i18nc('kajongg', 'red'), Tile.green: i18nc('kajongg', 'green'), East: i18nc('kajongg', 'East'), South: i18nc('kajongg', 'South'), West: i18nc('kajongg', 'West'), North: i18nc('kajongg', 'North') } for idx in Tile.numbers: names[idx] = chr(idx + 48) return names[self.value]
def headerData(self, section, orientation, role): """tell the view about the wanted headers""" if role == Qt.TextAlignmentRole: if orientation == Qt.Horizontal: return int(Qt.AlignLeft | Qt.AlignVCenter) if role != Qt.DisplayRole: return if orientation == Qt.Horizontal: if section == 0: return i18nc('Kajongg', 'Rule') if section == 1: return i18n(self.view.cbRuleset1.current.name) if section == 2: return i18n(self.view.cbRuleset2.current.name)
def headerData(self, section, orientation, role): """tell the view about the wanted headers""" if Qt is None: # happens when kajongg exits unexpectedly return if role == Qt.DisplayRole and orientation == Qt.Horizontal: if section >= self.rootItem.columnCount(): return result = self.rootItem.content(section) if result == 'doubles': return 'x2' else: return i18nc('kajongg', result) elif role == Qt.TextAlignmentRole: leftRight = Qt.AlignLeft if section == 0 else Qt.AlignRight return int(leftRight | Qt.AlignVCenter)
def __init__(self, scene): super(ScoreTable, self).__init__(None) self.setObjectName('ScoreTable') self.scene = scene self.scoreModel = None self.scoreModelTest = None decorateWindow(self, i18nc('kajongg', 'Scores')) self.setAttribute(Qt.WA_AlwaysShowToolTips) self.setMouseTracking(True) self.__tableFields = [ 'prevailing', 'won', 'wind', 'points', 'payments', 'balance', 'hand', 'manualrules' ] self.setupUi() self.refresh() StateSaver(self, self.splitter)
def typeName(self): """convert int to speaking name with shortcut. ATTENTION: UNTRANSLATED!""" # pylint: disable=too-many-return-statements if self.isBonus: return i18nc('kajongg meld type', 'Bonus') elif self.isSingle: return i18nc('kajongg meld type', '&single') elif self.isPair: return i18nc('kajongg meld type', '&pair') elif self.isChow: return i18nc('kajongg meld type', '&chow') elif self.isPung: return i18nc('kajongg meld type', 'p&ung') elif self.isClaimedKong: return i18nc('kajongg meld type', 'c&laimed kong') elif self.isKong: return i18nc('kajongg meld type', 'k&ong') else: return i18nc('kajongg meld type', 'rest of tiles')