def __init__(self, mainWindow): """Initializes the user list.""" super(QDockWidget, self).__init__(mainWindow) self.setWindowTitle(self.tr("Scratch Pad")) self.widget = QWidget(mainWindow) self.textArea = QTextEdit(mainWindow) self.currentEditingLabel = QLabel("No one is editing.") self.getLockButton = QPushButton("Edit") self.releaseLockButton = QPushButton("Confirm") #self.saveToFileButton = QPushButton("Save...") #self.loadButton = QPushButton("Load") self.layout = QGridLayout() self.layout.addWidget(self.currentEditingLabel, 0, 0, 1, 2) self.layout.addWidget(self.textArea, 1, 0, 1, 2) self.layout.addWidget(self.getLockButton, 2, 0) self.layout.addWidget(self.releaseLockButton, 2, 1) self.releaseLockButton.pressed.connect(self._releaseLock) self.getLockButton.pressed.connect(self._getLock) self.widget.setLayout(self.layout) self.setWidget(self.widget) self.setObjectName("Scratch Pad Widget") self.hasLock = False self.updateButtonStatus() try: with open(ospath.join(SAVE_DIR, "scratchpad.txt"), 'r') as autosave: self.textArea.setText(autosave.read()) except: pass mainWindow.addDockWidget(Qt.BottomDockWidgetArea, self)
def __init__(self, mainWindow): super(QDockWidget, self).__init__(mainWindow) #self.__eat = True self.painting = True self.dragging = False self.rectStart = None self.setWindowTitle(self.tr("Map Editor")) self.widget = QWidget(mainWindow) self.layout = QGridLayout() self.currentTileLayout = QBoxLayout(1) self.scrollarea = QScrollArea(mainWindow) self.noPaintingButton = QRadioButton(self.tr("Stop Painting"), mainWindow) self.singlePaintingButton = QRadioButton(self.tr("Single Tile Brush"), mainWindow) self.noPaintingButton.setChecked(True) self.rectPaintingButton = QRadioButton( self.tr("Area (Rectangle) Brush"), mainWindow) self.hollowRectPaintingButton = QRadioButton( self.tr("Hollow Rectangle Brush"), mainWindow) self.currentTileLabel = QLabel() self.currentTileLabelLabel = QLabel(self.tr("Current tile: ")) self.undoButton = QPushButton("Undo", mainWindow) self.redoButton = QPushButton("Redo", mainWindow) #self.moveMapButton = QPushButton("Move Map", mainWindow) self.layout.addWidget(self.scrollarea, 0, 0, 1, 2) self.layout.addWidget(self.noPaintingButton, 1, 0) self.layout.addWidget(self.singlePaintingButton, 2, 0) self.layout.addWidget(self.rectPaintingButton, 3, 0) self.layout.addWidget(self.hollowRectPaintingButton, 4, 0) self.layout.addWidget(self.undoButton, 1, 1) self.layout.addWidget(self.redoButton, 2, 1) #self.layout.addWidget(self.moveMapButton, 3, 1) self.layout.addWidget(self.currentTileLabel, 5, 1) self.layout.addWidget(self.currentTileLabelLabel, 5, 0) self.tilelabel = None self.widget.setLayout(self.layout) self.setWidget(self.widget) self.setObjectName("Map Editor") mainWindow.addDockWidget(Qt.RightDockWidgetArea, self) self.currentMap = None self.copyData = None self.undo = [] self.undoButton.clicked.connect(self._undo) self.undoButton.setEnabled(False) self.redo = [] self.redoButton.clicked.connect(self._redo) self.redoButton.setEnabled(False) addMapChangedListener(self.mapChangedResponse, NORMAL_RESPONSE_LEVEL) addMousePressListener(self.mousePressResponse, NORMAL_RESPONSE_LEVEL) addMouseMoveListener(self.mouseMoveResponse, NORMAL_RESPONSE_LEVEL) addMouseReleaseListener(self.mouseReleaseResponse, NORMAL_RESPONSE_LEVEL)
def __init__(self, mainWindow): super(QDockWidget, self).__init__(mainWindow) self.setToolTip( self.tr("Allows for drawing from a virtual deck of cards.")) self.setWindowTitle(self.tr("Deck")) #self.pristineCards = [] self.cards = [] self.deckDisplay = QListWidget() self.deckDisplay.itemActivated.connect(self.removeCard) self.cardNameField = QLineEdit() self.addCardButton = QPushButton("Add") self.addCardButton.clicked.connect(self.addCard) self.peekAmountField = QSpinBox() self.drawCardButton = QPushButton("Draw") self.drawCardButton.clicked.connect(self.drawCard) self.drawPlaceField = QSpinBox() self.peekCardButton = QPushButton("Peek") self.peekCardButton.clicked.connect(self.peekCard) self.refreshDeckButton = QPushButton("Initialize Deck") self.refreshDeckButton.clicked.connect(self.refreshDeck) self.shuffleDeckButton = QPushButton("Shuffle Deck") self.shuffleDeckButton.clicked.connect(self.shuffleDeck) self.loadButton = QPushButton("Load from file") self.loadButton.clicked.connect(self.loadFromFile) self.widget = QWidget(mainWindow) self.layout = QGridLayout() self.layout.addWidget(self.deckDisplay, 1, 0, 1, 2) self.layout.addWidget(self.cardNameField, 0, 0) self.layout.addWidget(self.addCardButton, 0, 1) self.layout.addWidget(self.drawCardButton, 2, 0) self.layout.addWidget(self.drawPlaceField, 2, 1) self.layout.addWidget(self.peekAmountField, 3, 0) self.layout.addWidget(self.peekCardButton, 3, 1) self.layout.addWidget(self.shuffleDeckButton, 4, 0) self.layout.addWidget(self.refreshDeckButton, 4, 1) self.layout.addWidget(self.loadButton, 5, 0, 1, 2) self.widget.setLayout(self.layout) self.setWidget(self.widget) self.setObjectName("Deck") mainWindow.addDockWidget(Qt.BottomDockWidgetArea, self) self.hide()
def __init__(self, mainWindow): """Initializes the user list.""" super(QDockWidget, self).__init__(mainWindow) self.setToolTip(self.tr("People presently playing.")) self.setWindowTitle(self.tr("Connected Users")) self.widget = QWidget(mainWindow) self.listOfUsers = userListList(mainWindow, self) self.internalList = [] self.layout = QGridLayout() self.layout.addWidget(self.listOfUsers, 0, 0, 1, 2) self.widget.setLayout(self.layout) self.widget.setMaximumWidth( 200) #Arbitrary; keeps it from taking over 1/3 of the screen self.setWidget(self.widget) self.setObjectName("User List Widget") self.gmname = None self.localname = None mainWindow.addDockWidget(Qt.BottomDockWidgetArea, self)
def __init__(self, mainWindow): super(QDockWidget, self).__init__(mainWindow) self.setToolTip( self.tr("A widget for out-of-character chat and system messages.")) self.setWindowTitle(self.tr("OOC Chat / System")) self.widgetEditor = QTextBrowser(mainWindow) self.widgetLineInput = chatLineEdit(mainWindow) self.widgetLineInput.setToolTip( self.tr( "Type text here and press Enter or Return to transmit it.")) self.widget = QWidget(mainWindow) self.widgetEditor.setReadOnly(True) self.widgetEditor.setOpenLinks(False) self.layout = QBoxLayout(2) self.layout.addWidget(self.widgetEditor) self.layout.addWidget(self.widgetLineInput) self.widget.setLayout(self.layout) self.setWidget(self.widget) self.setObjectName("Chat Widget") self.timestamp = False self.timestampformat = "[%H:%M:%S]" self.messageCache = [] try: js = jsonload(ospath.join(SAVE_DIR, "ui_settings.rgs")) except: pass try: self.toggleTimestamp( loadString('chatWidget.timestamp', js.get('timestamp'))) except: pass try: self.timestampformat = loadString('chatWidget.timestampformat', js.get('timestampformat')) except: pass mainWindow.addDockWidget(Qt.BottomDockWidgetArea, self) self.widgetEditor.anchorClicked.connect(self.anchorClicked) self.widgetLineInput.returnPressed.connect(self.processInput)
def __init__(self, mainWindow): super(QDockWidget, self).__init__(mainWindow) self.setWindowTitle(self.tr("Dice")) self.realwidget = QWidget( mainWindow ) #I messed up on the initial setup and was too lazy to rename everything. self.widget = QGridLayout() self.diceArea = QListWidget(mainWindow) try: self.load(jsonload(ospath.join(SAVE_DIR, "dice.rgd"))) except: self.macros = [ QListWidgetItem(QIcon('data/dice.png'), "Sample: 2d6"), QListWidgetItem(QIcon('data/dice.png'), "Sample: 4k2"), QListWidgetItem(QIcon('data/dice.png'), "Sample: 1dn3") ] for m in self.macros: self.diceArea.addItem(m) self.diceArea.currentRowChanged.connect(self.changeCurrentMacro) self.rollbutton = QPushButton(self.tr("Roll"), mainWindow) self.rollbutton.setToolTip( self.tr("Roll dice according to the selected macro.")) self.addmacrobutton = QPushButton(self.tr("Add Macro"), mainWindow) self.addmacrobutton.setToolTip( self.tr("Add a new macro via a dialog box.")) self.removemacrobutton = QPushButton(self.tr("Delete Macro"), mainWindow) self.removemacrobutton.setToolTip( self.tr("Remove the currently selected macro.")) self.rollbutton.clicked.connect(self.rollDice) self.addmacrobutton.clicked.connect(self.summonMacro) self.removemacrobutton.clicked.connect(self.removeCurrentMacro) self.widget.addWidget(self.diceArea, 0, 0) self.widget.addWidget(self.rollbutton, 1, 0) self.widget.addWidget(self.addmacrobutton, 2, 0) self.widget.addWidget(self.removemacrobutton, 3, 0) self.realwidget.setLayout(self.widget) self.setWidget(self.realwidget) self.setObjectName("Dice Widget") mainWindow.addDockWidget(Qt.BottomDockWidgetArea, self) self.close() self.currentMacro = -1
def __init__(self, mainWindow): super(QDockWidget, self).__init__(mainWindow) self.setWindowTitle("Pog Editor") self.setObjectName("Pog Editor") self.currentImage = None self.editedImage = None self.validBorderSizes = [(64, 64), (128, 128), (256, 256)] self.scrollarea = pogEditScrollArea(mainWindow, self) self.openButton = QPushButton("Open File", mainWindow) self.openButton.clicked.connect(self.promptOpenFile) self.saveButton = QPushButton("Save Pog", mainWindow) self.saveButton.clicked.connect(self.promptSaveFile) self.savePortraitButton = QPushButton("Save Portrait", mainWindow) self.savePortraitButton.clicked.connect(self.promptSavePortrait) self.resetButton = QPushButton("Reset Changes", mainWindow) self.resetButton.clicked.connect(self.resetImage) self.borderButton = QPushButton("Add Pog Border", mainWindow) self.borderButton.clicked.connect(self.addPogBorder) self.resizeButton = QPushButton("Resize...", mainWindow) self.resizeButton.clicked.connect(self.promptResize) self.layout = QGridLayout() self.layout.addWidget(self.scrollarea, 0, 0, 1, 3) self.layout.addWidget(self.openButton, 1, 0) self.layout.addWidget(self.borderButton, 1, 1) self.layout.addWidget(self.resizeButton, 1, 2) self.layout.addWidget(self.resetButton, 2, 0) self.layout.addWidget(self.saveButton, 2, 1) self.layout.addWidget(self.savePortraitButton, 2, 2) self.widget = QWidget() self.widget.setLayout(self.layout) self.setAcceptDrops(True) self.setWidget(self.widget) mainWindow.addDockWidget(Qt.RightDockWidgetArea, self)
def __init__(self, mainWindow): super(QDockWidget, self).__init__(mainWindow) self.setToolTip( self.tr("Allows for monitoring and control of file transfers.")) self.setWindowTitle(self.tr("Transfer Monitor")) self.transferDict = {} self.transferTable = QTableWidget(0, 3, mainWindow) self.transferTable.setHorizontalHeaderLabels( ["Client", "Filename", "Status"]) self.widget = QWidget(mainWindow) self.status = QLabel("Initializing", mainWindow) self.layout = QBoxLayout(2) self.layout.addWidget(self.transferTable) self.layout.addWidget(self.status) self.widget.setLayout(self.layout) self.setWidget(self.widget) self.setObjectName("Transfer Monitor") mainWindow.addDockWidget(Qt.BottomDockWidgetArea, self) self.hide()
def __init__(self, mainWindow): """Initializes the pog palette.""" super(QDockWidget, self).__init__(mainWindow) self.setToolTip( self. tr("Drag a file from this widget into the game window to place a pog." )) self.setWindowTitle(self.tr("Pog Palette")) self.widget = QWidget(mainWindow) self.mainLayout = QBoxLayout(2) self.pogsModel = PogFileSystemModel() self.ROOT_LEN = len(self.pogsModel.absRoot) + 1 self.pogArea = pogTree(mainWindow) self.pogArea.setModel(self.pogsModel) self.pogArea.setRootIndex(self.pogsModel.index(POG_DIR)) self.pogArea.setColumnHidden(1, True) self.pogArea.setColumnHidden(2, True) self.pogArea.setColumnHidden(3, True) self.pogArea.setDragDropMode(QAbstractItemView.DragDrop) self.mainLayout.addWidget(self.pogArea) self.widget.setLayout(self.mainLayout) self.setWidget(self.widget) self.setObjectName("Pog Palette") mainWindow.addDockWidget(Qt.BottomDockWidgetArea, self)
def __init__(self, mainWindow): super(QDockWidget, self).__init__(mainWindow) self.setToolTip(self.tr("A widget for in-character chat.")) self.setWindowTitle(self.tr("IC Chat")) self.widgetEditor = QTextBrowser(mainWindow) self.widgetLineInput = chatLineEdit(mainWindow) self.widgetLineInput.setToolTip( self.tr( "Type text here and press Enter or Return to transmit it.")) self.widget = QWidget(mainWindow) self.widgetEditor.setReadOnly(True) self.widgetEditor.setOpenLinks(False) self.characterPreview = QLabel(mainWindow) self.characterSelector = QComboBox(mainWindow) self.characterSelector.setToolTip( self. tr("Select the character to be displayed as the speaker of entered text." )) self.characterAddButton = QPushButton(self.tr("Add New"), mainWindow) self.characterAddButton.setToolTip( self.tr("Add a new in-character chat character via a dialog box.")) self.characterDeleteButton = QPushButton(self.tr("Delete"), mainWindow) self.characterDeleteButton.setToolTip( self.tr( "Delete the currently selected in-character chat character.")) self.characterClearButton = QPushButton(self.tr("Clear"), mainWindow) self.characterClearButton.setToolTip( self.tr("Deletes all in-character chat characters.")) self.layout = QGridLayout() self.layout.addWidget(self.widgetEditor, 0, 0, 1, 4) self.layout.addWidget(self.widgetLineInput, 1, 1, 1, 3) self.layout.addWidget(self.characterPreview, 1, 0, 2, 1) self.layout.addWidget(self.characterDeleteButton, 2, 3, 1, 1) self.layout.addWidget(self.characterClearButton, 3, 3, 1, 1) self.layout.addWidget(self.characterAddButton, 2, 2, 1, 1) self.layout.addWidget(self.characterSelector, 2, 1, 1, 1) self.widget.setLayout(self.layout) self.setWidget(self.widget) self.setObjectName("IC Chat Widget") self.messageCache = [] self.setAcceptDrops(True) mainWindow.addDockWidget(Qt.LeftDockWidgetArea, self) #TODO: Store and access characters in a better fashion. try: self.load(jsonload(ospath.join(CHAR_DIR, "autosave.rgc"))) except: self.characters = [] self.widgetLineInput.returnPressed.connect(self.processInput) self.characterAddButton.clicked.connect(self.newCharacter) self.characterDeleteButton.clicked.connect(self.deleteCharacter) self.characterClearButton.clicked.connect(self.clearCharacters) self.characterSelector.currentIndexChanged.connect( self.setCharacterPreview) self.updateDeleteButton() self.setCharacterPreview()