def __init__(self, parent=None): super(EditTMs, self).__init__(EditWidget.TAB, parent) self.tabname = "TMs/HMs" self.valuers = [] x = 0 y = 0 off = 0 txt = "%s%%02i" % translate("pokemontm") if pokeversion.gens[config.project["versioninfo"][0]] == 4: tmmax = 92 else: tmmax = 95 for i in range(104): sb = EditWidget(EditWidget.CHECKBOX, self) if i == 60: x = width mheight = y y = 0 elif i == tmmax: txt = "%s%%02i" % translate("pokemonhm") off = tmmax sb.setName(txt % (i - off + 1)) width, height = sb.getGeometry() sb.setGeometry(QRect(x, y, width, height)) sb.changed = self._changed self.valuers.append(sb) y += height self.setGeometry(0, 0, width * 2, mheight)
def __init__(self, parent=None): super(EditTMs, self).__init__(EditWidget.TAB, parent) self.tabname = "TMs/HMs" self.valuers = [] x = 0 y = 0 off = 0 txt = "%s%%02i"%translate("pokemontm") if pokeversion.gens[config.project["versioninfo"][0]] == 4: tmmax = 92 else: tmmax = 95 for i in range(104): sb = EditWidget(EditWidget.CHECKBOX, self) if i == 60: x = width mheight = y y = 0 elif i == tmmax: txt = "%s%%02i"%translate("pokemonhm") off = tmmax sb.setName(txt%(i-off+1)) width, height = sb.getGeometry() sb.setGeometry(QRect(x, y, width, height)) sb.changed = self._changed self.valuers.append(sb) y += height self.setGeometry(0, 0, width*2, mheight)
class EditMoves(EditWidget): def __init__(self, size="H", parent=None): super(EditMoves, self).__init__(EditWidget.NONE, parent) self.datasize = size y = 0 x = 25 self.mover = EditWidget(EditWidget.COMBOBOX, self) self.mover.changed = self._changed width, height = self.mover.getGeometry() self.mover.setGeometry(QRect(x, y, width, height)) y += height self.leveler = EditWidget(EditWidget.SPINBOX, self) self.leveler.changed = self._changed if self.datasize == "I": self.leveler.setValues([0, 0xFFFF]) else: self.leveler.setValues([0, 0x7F]) width, height = self.leveler.getGeometry() self.leveler.setGeometry(QRect(x, y, width, height)) y += height self.deleter = QPushButton("X", self) self.deleter.setGeometry(0, 0, x, y) QObject.connect(self.deleter, QtCore.SIGNAL("pressed()"), self._remove) self.setGeometry(0, 0, x + width, y) def _remove(self): self.remove(self) def setName(self, name): self.mover.setName("Move") self.leveler.setName("Level") def setValue(self, value): if self.datasize == "I": self.mover.setValue(value & 0xFFFF) self.leveler.setValue((value >> 16) & 0xFFFF) else: self.mover.setValue(value & 0x1FF) self.leveler.setValue((value >> 9) & 0x7F) def getValue(self): if self.datasize == "I": value = (self.leveler.getValue() << 16) | (self.mover.getValue()) else: value = (self.leveler.getValue() << 9) | (self.mover.getValue()) return value def getGeometry(self): return (self.geometry().width(), self.geometry().height()) def __lt__(self, other): if isinstance(other, EditMoves): return self.leveler.getValue() < other.leveler.getValue() return self.getValue() < other.getValue()
class EditMoves(EditWidget): def __init__(self, size="H", parent=None): super(EditMoves, self).__init__(EditWidget.NONE, parent) self.datasize = size y = 0 x = 25 self.mover = EditWidget(EditWidget.COMBOBOX, self) self.mover.changed = self._changed width, height = self.mover.getGeometry() self.mover.setGeometry(QRect(x, y, width, height)) y += height self.leveler = EditWidget(EditWidget.SPINBOX, self) self.leveler.changed = self._changed if self.datasize == "I": self.leveler.setValues([0, 0xFFFF]) else: self.leveler.setValues([0, 0x7F]) width, height = self.leveler.getGeometry() self.leveler.setGeometry(QRect(x, y, width, height)) y += height self.deleter = QPushButton("X", self) self.deleter.setGeometry(0, 0, x, y) QObject.connect(self.deleter, QtCore.SIGNAL("pressed()"), self._remove) self.setGeometry(0, 0, x+width, y) def _remove(self): self.remove(self) def setName(self, name): self.mover.setName("Move") self.leveler.setName("Level") def setValue(self, value): if self.datasize == "I": self.mover.setValue(value&0xFFFF) self.leveler.setValue((value>>16)&0xFFFF) else: self.mover.setValue(value&0x1FF) self.leveler.setValue((value>>9)&0x7F) def getValue(self): if self.datasize == "I": value = (self.leveler.getValue()<<16) | (self.mover.getValue()) else: value = (self.leveler.getValue()<<9) | (self.mover.getValue()) return value def getGeometry(self): return (self.geometry().width(), self.geometry().height()) def __lt__(self, other): if isinstance(other, EditMoves): return self.leveler.getValue() < other.leveler.getValue() return self.getValue() < other.getValue()
def __init__(self, parent=None): super(EditEVs, self).__init__(EditWidget.NONE, parent) self.valuers = [] x = 0 y = 0 for stat in stats: sb = EditWidget(EditWidget.SPINBOX, self) sb.setValues([0, 3]) sb.setName(translate("pokemonstat_" + stat) + " EV") width, height = sb.getGeometry() sb.setGeometry(QRect(x, y, width, height)) sb.changed = self._changed self.valuers.append(sb) y += height self.setGeometry(0, 0, width, y)
def __init__(self, parent=None): super(EditEVs, self).__init__(EditWidget.NONE, parent) self.valuers = [] x = 0 y = 0 for stat in stats: sb = EditWidget(EditWidget.SPINBOX, self) sb.setValues([0, 3]) sb.setName(translate("pokemonstat_"+stat)+" EV") width, height = sb.getGeometry() sb.setGeometry(QRect(x, y, width, height)) sb.changed = self._changed self.valuers.append(sb) y += height self.setGeometry(0, 0, width, y)