当前位置: 首页>>代码示例>>Python>>正文


Python QFont.setPointSize方法代码示例

本文整理汇总了Python中PySide.QtGui.QFont.setPointSize方法的典型用法代码示例。如果您正苦于以下问题:Python QFont.setPointSize方法的具体用法?Python QFont.setPointSize怎么用?Python QFont.setPointSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PySide.QtGui.QFont的用法示例。


在下文中一共展示了QFont.setPointSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: initUI

# 需要导入模块: from PySide.QtGui import QFont [as 别名]
# 或者: from PySide.QtGui.QFont import setPointSize [as 别名]
    def initUI(self):
        self.setWindowTitle('TickTackToe 2000')

        self.resize(350, 350)
        self.center()

        self.main_layout = QVBoxLayout()

        self.form_layout = QGridLayout()
        self.main_layout.addLayout(self.form_layout)

        splitter = QSplitter(QtCore.Qt.Horizontal)
        self.main_layout.addWidget(splitter)

        self.game_layout = QGridLayout()
        self.main_layout.addLayout(self.game_layout)

        self.server_label = QLabel("Server: ")
        self.server_input = QLineEdit("127.0.0.1")
        self.form_layout.addWidget(self.server_label, 0, 0)
        self.form_layout.addWidget(self.server_input, 0, 1)

        self.port_label = QLabel("Port: ")
        self.port_input = QLineEdit("1632")
        self.form_layout.addWidget(self.port_label, 1, 0)
        self.form_layout.addWidget(self.port_input, 1, 1)

        self.connect_button = QPushButton("Connect")
        self.connect_button.setMinimumHeight(60)
        self.connect_button.pressed.connect(self.reconnect)
        self.form_layout.addWidget(self.connect_button, 0, 2, 2, 1)

        self.game_fields = {}

        tile_font = QFont()
        tile_font.setPointSize(30)

        for x in range(0, GAME_SIZE):
            for y in range(0, GAME_SIZE):
                f = QPushButton(" ")
                f.setMinimumHeight(90)
                f.setDisabled(True)
                f.setFont(tile_font)
                f.clicked.connect(self.onGameButtonClicked)

                if x in self.game_fields:
                    self.game_fields[x][y] = f
                else:
                    self.game_fields[x] = { 0: f }

                self.game_layout.addWidget(f, y, x)

        central_widget = QtGui.QWidget()
        central_widget.setLayout(self.main_layout)
        self.setCentralWidget(central_widget)

        self.statusBar().showMessage("")

        self.show()
开发者ID:pidpawel,项目名称:tictactoe,代码行数:61,代码来源:client.py

示例2: drawGameOver

# 需要导入模块: from PySide.QtGui import QFont [as 别名]
# 或者: from PySide.QtGui.QFont import setPointSize [as 别名]
 def drawGameOver(self, painter):
     """ Draw the Game Over Message """
     font = QFont()
     font.setPointSize(48)
     penColor = QColor(255, 0, 0)
     
     painter.setFont(font)
     painter.setPen(penColor)
     painter.drawText(self.contentsRect(), Qt.AlignCenter, "Game Over")
开发者ID:cloew,项目名称:GalagaEsque,代码行数:11,代码来源:level_view.py

示例3: drawScore

# 需要导入模块: from PySide.QtGui import QFont [as 别名]
# 或者: from PySide.QtGui.QFont import setPointSize [as 别名]
 def drawScore(self, painter):
     """ Draw the Score label """
     font = QFont()
     font.setPointSize(24)
     penColor = QColor(238, 250, 12)
     
     painter.setFont(font)
     painter.setPen(penColor)
     painter.drawText(10, 50, "Score: {0:,}".format(self.level.score))
开发者ID:cloew,项目名称:GalagaEsque,代码行数:11,代码来源:level_view.py

示例4: drawPaused

# 需要导入模块: from PySide.QtGui import QFont [as 别名]
# 或者: from PySide.QtGui.QFont import setPointSize [as 别名]
 def drawPaused(self, painter):
     """ Draw the Paused Message """
     font = QFont()
     font.setPointSize(48)
     penColor = QColor(238, 250, 12)
     
     painter.setFont(font)
     painter.setPen(penColor)
     painter.drawText(self.contentsRect(), Qt.AlignCenter, "Paused")
开发者ID:cloew,项目名称:GalagaEsque,代码行数:11,代码来源:level_view.py

示例5: AdjacencyClueView

# 需要导入模块: from PySide.QtGui import QFont [as 别名]
# 或者: from PySide.QtGui.QFont import setPointSize [as 别名]
class AdjacencyClueView(QFrame): # Prolly could use a better name
    """ Represents the Adjacency Clue View """
    TRANSPARENCY = 100
    
    def __init__(self, adjacencyClue, fragilityClue, parent=None):
        """ Initialize the Adjacency Clue View """
        QFrame.__init__(self, parent)
        self.adjacencyClue = adjacencyClue
        self.fragilityClue = fragilityClue
        self.resize(34, 32)
        self.setupClueLabel()
        
    def setupFont(self):
        """ Setup the Font """
        self.font = QFont()
        self.font.setPointSize(15)
        
    def setupClueLabel(self):
        """ Setup the Clue Label """
        self.setupFont()
        self.clueLabel = QLabel('', self)
        self.clueLabel.setFont(self.font)
        self.clueLabel.move(0, 0)
        
    def updateView(self):
        """ Update the View """
        self.clueLabel.setText(self.getLabelText())
        self.setColorBasedOnFragility()
        self.clueLabel.resize(34, self.clueLabel.contentsRect().height())
        
    def getLabelText(self):
        """ Get the CLue Reading Text """
        adjacentMines = self.adjacencyClue.getAdjacentMinesClue()
        if adjacentMines == 0:
            return ''
        else:
            return str(adjacentMines)
        
    def setColorBasedOnFragility(self):
        """ Set color of the clue based on adjacency to Fragile Mines """
        color = "rgba({0}, {1}%)".format(self.getColor(), self.TRANSPARENCY)
        self.clueLabel.setStyleSheet("QLabel { color : %s }" % color)
        
    def getColor(self):
        """ Return color """
        if self.fragilityClue.distance is None:
            return "0, 0, 0"
        elif self.fragilityClue.distance <= 1:
            if self.fragilityClue.count == 1:
                return "227, 68, 20"
            else:
                return "196, 0, 0"
        elif self.fragilityClue.distance > 1 and self.fragilityClue.distance < 4:
            return "244, 244, 0"
        elif self.fragilityClue.distance >= 4:
            return "0, 154, 0"
开发者ID:cloew,项目名称:PyMine,代码行数:58,代码来源:adjacency_clue_view.py

示例6: LevelOverviewView

# 需要导入模块: from PySide.QtGui import QFont [as 别名]
# 或者: from PySide.QtGui.QFont import setPointSize [as 别名]
class LevelOverviewView(QFrame):
    """ Represents the View of the Level Overview """

    WIDTH = 120
    HEIGHT = 64

    def __init__(self, parent, level, levelSelection):
        """ Initialize the Level Overview View """
        QFrame.__init__(self, parent)

        self.resize(self.WIDTH, self.HEIGHT)
        self.level = level
        self.levelSelection = levelSelection

        self.bigFont = QFont()
        self.bigFont.setPointSize(32)

        self.smallFont = QFont()
        self.smallFont.setPointSize(24)

        self.label = self.getLabel(self.smallFont)

    def getLabel(self, font):
        """ Get a Level Label witht he apropriate Font """
        label = QLabel(self.level.name, self)
        label.setFont(self.smallFont)
        label.setAlignment(Qt.AlignCenter)
        label.resize(self.WIDTH, self.HEIGHT)
        return label

    def updateView(self):
        """ Update the View """
        if self.levelSelection.getLevel() is self.level:
            self.label.setFont(self.bigFont)
        else:
            self.label.setFont(self.smallFont)

        self.update()

    def getWidth(self):
        """ Return the Width of the Level Overview View """
        return self.label.contentsRect().width()
开发者ID:cloew,项目名称:PyMine,代码行数:44,代码来源:level_overview_view.py

示例7: __init__

# 需要导入模块: from PySide.QtGui import QFont [as 别名]
# 或者: from PySide.QtGui.QFont import setPointSize [as 别名]
	def __init__(self, parent=None):
		super(managebkm, self).__init__(parent)
		appicom = QIcon(":/icons/njnlogo.png")
		self.setWindowIcon(appicom)
		self.setWindowTitle("Nigandu | Manage Book Marks")
		self.setFixedSize(463, 242)

		self.verticalLayoutWidget = QWidget(self)
		self.verticalLayoutWidget.setGeometry(QRect(350, 30, 101, 201))
		self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
		self.verticalLayout = QVBoxLayout(self.verticalLayoutWidget)
		self.verticalLayout.setContentsMargins(0, 0, 0, 0)
		self.verticalLayout.setObjectName("verticalLayout")

		self.sortbtn = QPushButton(self.verticalLayoutWidget)
		self.sortbtn.setText("&Sort")
		self.verticalLayout.addWidget(self.sortbtn)

		self.deletebtn = QPushButton(self.verticalLayoutWidget)
		self.deletebtn.setText("&Delete")
		self.verticalLayout.addWidget(self.deletebtn)

		self.deleteallbtn = QPushButton(self.verticalLayoutWidget)
		self.deleteallbtn.setText("Delete &All")
		self.verticalLayout.addWidget(self.deleteallbtn)

		self.closebtn = QPushButton(self.verticalLayoutWidget)
		self.closebtn.setText("&Close")
		self.verticalLayout.addWidget(self.closebtn)

		self.listWidget = QListWidget(self)
		self.listWidget.setGeometry(QRect(10, 30, 331, 201))

		self.label = QLabel(self)
		self.label.setGeometry(QRect(20, 10, 91, 25))
		font = QFont()
		font.setPointSize(10)
		self.label.setFont(font)
		self.label.setBuddy(self.listWidget)
		self.label.setText("Book Mark List:")
开发者ID:jnoortheen,项目名称:nigandu,代码行数:42,代码来源:managebkm.py

示例8: EditorWindow

# 需要导入模块: from PySide.QtGui import QFont [as 别名]
# 或者: from PySide.QtGui.QFont import setPointSize [as 别名]

#.........这里部分代码省略.........

    '''
    close and cleanup tixi
    '''
    def __del__(self):
        pass
        #self.tixi.close()
        #self.tixi.cleanup() 

    '''
    set and connect the search buttons
    '''
    def setupButtonMenu(self):
        self.button1         = QPushButton("previous" )
        self.button2         = QPushButton("next" )
        self.label1          = QLabel("font")
        self.fontsizeSpinBox = QSpinBox()
        
        self.button1.hide()
        self.button2.hide()
        self.label1.hide()
        self.fontsizeSpinBox.hide()

        self.button1.clicked.connect(self.fire_search_backward)
        self.button2.clicked.connect(self.fire_search_foreward)
         
        self.fontsizeSpinBox.setRange(4, 30)
        self.fontsizeSpinBox.setSingleStep(1)
        self.fontsizeSpinBox.setSuffix('pt')
        self.fontsizeSpinBox.setValue(10)        
        self.fontsizeSpinBox.valueChanged.connect(self.setfontsize)         
    
    def setfontsize(self, value):
        self.font.setPointSize(value)
        self.editor.setFont(self.font)
                
    def setupEditor(self):
        self.font = QFont()
        self.font.setFamily('Courier')
        self.font.setFixedPitch(True)
        self.font.setPointSize(10)
        
        self.editor = EditorCodeCompletion(Config().path_code_completion_dict)       
        self.editor.setFont(self.font)
        self.editor.setTabStopWidth(20)
        self.editor.setAcceptRichText(False)
        self.editor.setLineWrapMode(QTextEdit.NoWrap)
        self.editor.textChanged.connect(self.validate)
        
        self.highlighter = Highlighter(self.editor.document())
    
    def setupNumbar(self):
        self.number_bar = NumberBar()
        self.number_bar.setTextEdit(self.getStates())
        self.editor.cursorPositionChanged.connect(self.fireUpdateNumbar)        
        self.connect(self.editor.verticalScrollBar(), SIGNAL("valueChanged(int)"), self.fireUpdateNumbar)  
        #self.editor.verticalScrollBar.valueChanged.connect(self.fireUpdateNumbar)

    def setupStatusbar(self):
        self.lineNumber = -1
        self.colNumber = -1
        self.m_statusRight = QLabel("row: " + str(self.lineNumber) + ", col:"  + str(self.colNumber), self)
        self.statusBar().addPermanentWidget(self.m_statusRight, 0) 

    def setupSearchBox(self):
        self.searchbox = SearchField() 
开发者ID:frankfx,项目名称:master_thesis,代码行数:70,代码来源:editor_xml.py

示例9: LandmarkLocationWidget

# 需要导入模块: from PySide.QtGui import QFont [as 别名]
# 或者: from PySide.QtGui.QFont import setPointSize [as 别名]
class LandmarkLocationWidget(QWidget):
	# Signals
	activated = Signal(int, bool)
	deleted = Signal(int)

	def __init__(self):
		super(LandmarkLocationWidget, self).__init__()
		self._active = False
		self._font = QFont()
		self._font.setPointSize(10)

		self.indexLabel = QLabel()
		self.indexLabel.setMaximumWidth(10)
		self.indexLabel.setMinimumWidth(10)

		self.doneButton = QPushButton("Done")
		self.doneButton.setMaximumWidth(50)
		self.doneButton.setFont(self._font)
		self.doneButton.clicked.connect(self.doneButtonClicked)

		self.deleteButton = QPushButton("X")
		self.deleteButton.setMaximumWidth(15)
		self.deleteButton.setMinimumWidth(15)
		self.deleteButton.setMaximumHeight(15)
		self.deleteButton.setMinimumHeight(15)
		self.deleteButton.setFont(self._font)
		self.deleteButton.setVisible(False)
		self.deleteButton.clicked.connect(self.deleteButtonClicked)

		self.fixedButton = SpecialButton()
		self.fixedButton.setFont(self._font)
		self.movingButton = SpecialButton()
		self.movingButton.setFont(self._font)

		layout = QGridLayout()
		layout.setContentsMargins(0, 0, 0, 0)
		layout.setVerticalSpacing(0)
		layout.addWidget(self.deleteButton, 0, 0)
		layout.addWidget(self.indexLabel, 0, 1)
		layout.addWidget(self.fixedButton, 0, 2)
		layout.addWidget(self.movingButton, 0, 3)
		layout.addWidget(self.doneButton, 0, 4)
		self.setLayout(layout)
		self._updateState()
		
	def setIndex(self, index):
		self.index = index
		self.indexLabel.setText(str(index+1))

	@property
	def active(self):
		return self._active

	@active.setter
	def active(self, value):
		self._active = value
		self._updateState()

	def setLandmarkSet(self, points):
		self.setFixedLandmark(points[0])
		self.setMovingLandmark(points[1])

	def setFixedLandmark(self, landmark):
		if not landmark:
			return
		labelX = "%2.0f" % landmark[0]
		labelY = "%2.0f" % landmark[1]
		labelZ = "%2.0f" % landmark[2]
		self.fixedButton.setText(labelX + ", " + labelY + ", " + labelZ)

	def setMovingLandmark(self, landmark):
		if not landmark:
			return
		labelX = "%2.0f" % landmark[0]
		labelY = "%2.0f" % landmark[1]
		labelZ = "%2.0f" % landmark[2]
		self.movingButton.setText(labelX + ", " + labelY + ", " + labelZ)

	@Slot()
	def doneButtonClicked(self):
		self._active = not self._active
		self.activated.emit(self.index, self._active)
		self._updateState()

	@Slot()
	def deleteButtonClicked(self):
		self.deleted.emit(self.index)

	def _updateState(self):
		text = "Done" if self._active else "Edit"
		self.doneButton.setText(text)
		self.deleteButton.setVisible(self._active)
		self.indexLabel.setVisible(not self._active)
		self.fixedButton.setEnabled(self._active)
		self.movingButton.setEnabled(self._active)
开发者ID:berendkleinhaneveld,项目名称:Registrationshop,代码行数:97,代码来源:PointsWidget.py

示例10: LevelCompletionView

# 需要导入模块: from PySide.QtGui import QFont [as 别名]
# 或者: from PySide.QtGui.QFont import setPointSize [as 别名]
class LevelCompletionView(QFrame):
    """ View of the Level Completion Status """
    
    def __init__(self, level, width, height, parent=None):
        """ Initialize the Level Completion View """
        QFrame.__init__(self, parent)
        self.level = level
        
        self.setup()
        self.updateView()
        
        self.color = QColor(200, 200, 200)
        self.setStyleSheet("QFrame { background-color: %s }" % self.color.name()) 
        self.resize(width, height)
        
    def setup(self):
        """ Setup the View """
        self.setupFont()
        self.setupLevelCompletionLabel()
        self.setupCompletionDetailsLabel()
        
    def setupFont(self):
        """ Setup the Font """
        self.font = QFont()
        self.font.setPointSize(32)
        
    def setupLevelCompletionLabel(self):
        """ Setup the Power Label """
        self.font = QFont()
        self.font.setPointSize(32)
        
        self.levelCompletionLabel = QLabel("You Won!", self)
        self.levelCompletionLabel.move(32, 16)
        self.levelCompletionLabel.setFont(self.font)
        self.levelCompletionLabel.setVisible(False)
        
    def setupCompletionDetailsLabel(self):
        """ Setup the Remaining Mines Label """
        self.font = QFont()
        self.font.setPointSize(24)
        
        self.completionDetailsLabel = QLabel("Destroyed!", self)
        self.completionDetailsLabel.move(32, 64)
        self.completionDetailsLabel.setFont(self.font)
        self.completionDetailsLabel.setVisible(False)
        
    def updateView(self):
        """ Update the View """
        self.updateLevelCompletionLabel()
        self.updateCompletionDetailsLabel()
        
    def updateLevelCompletionLabel(self):
        """ Update the Power Label """
        if self.level.won():
            self.levelCompletionLabel.setText("You Won!")
            self.levelCompletionLabel.setVisible(True)
        elif self.level.lost():
            self.levelCompletionLabel.setText("Game Over!")
            self.levelCompletionLabel.setVisible(True)
        
    def updateCompletionDetailsLabel(self):
        """ Update the Remaining Mines Label """
        if self.level.destroyed():
            self.completionDetailsLabel.setText("Destroyed")
            self.completionDetailsLabel.setVisible(True)
        elif self.level.noPower() and not self.level.won():
            self.completionDetailsLabel.setText("Insufficient Power")
            self.completionDetailsLabel.setVisible(True)
        elif self.level.won():
            text = ""
            if self.level.completionRating.awarded:
                text += "C"
            if self.level.moveRating.awarded:
                text += "M"
            if self.level.powerRating.awarded:
                text += "P"
            self.completionDetailsLabel.setText(text)
            self.completionDetailsLabel.setVisible(True)
开发者ID:cloew,项目名称:PyMine,代码行数:80,代码来源:level_completion_view.py

示例11: QApplication

# 需要导入模块: from PySide.QtGui import QFont [as 别名]
# 或者: from PySide.QtGui.QFont import setPointSize [as 别名]
from sys import argv, exit
from PySide.QtGui import QApplication, QFont, QFontMetrics
from mainwindow import MainWindow

app = QApplication(argv)
font = QFont(QApplication.font())
font.setPointSize(14)
w = MainWindow()
metrics = QFontMetrics(font)
w.resize(metrics.width('M') * 80, metrics.height() * 24)
w.show()
exit(app.exec_())
开发者ID:tps12,项目名称:hey-grid,代码行数:14,代码来源:main.py

示例12: __init__

# 需要导入模块: from PySide.QtGui import QFont [as 别名]
# 或者: from PySide.QtGui.QFont import setPointSize [as 别名]
 def __init__(self, parent=None):
     super(Truss, self).__init__(parent)        
     self.resize(800, 600)
     self.filename  = None
     self.filetuple = None
     self.dirty = False  # Refers to Data Page only.
     centralwidget = QWidget(self)
     gridLayout = QGridLayout(centralwidget)
     self.tabWidget = QTabWidget(centralwidget)
     self.tab = QWidget()
     font = QFont()
     font.setFamily("Courier 10 Pitch")
     font.setPointSize(12)
     self.tab.setFont(font)
     gridLayout_3 = QGridLayout(self.tab)
     self.plainTextEdit = QPlainTextEdit(self.tab)
     gridLayout_3.addWidget(self.plainTextEdit, 0, 0, 1, 1)
     self.tabWidget.addTab(self.tab, "")
     self.tab_2 = QWidget()
     self.tab_2.setFont(font)
     gridLayout_2 = QGridLayout(self.tab_2)
     self.plainTextEdit_2 = QPlainTextEdit(self.tab_2)
     gridLayout_2.addWidget(self.plainTextEdit_2, 0, 0, 1, 1)
     self.tabWidget.addTab(self.tab_2, "")
     gridLayout.addWidget(self.tabWidget, 0, 0, 1, 1)
     self.setCentralWidget(centralwidget)
     menubar = QMenuBar(self)
     menubar.setGeometry(QRect(0, 0, 800, 29))
     menu_File = QMenu(menubar)
     self.menu_Solve = QMenu(menubar)
     self.menu_Help = QMenu(menubar)
     self.setMenuBar(menubar)
     self.statusbar = QStatusBar(self)
     self.setStatusBar(self.statusbar)
     self.action_New = QAction(self)
     self.actionSave_As = QAction(self)
     self.action_Save = QAction(self)
     self.action_Open = QAction(self)
     self.action_Quit = QAction(self)
     self.action_About = QAction(self)
     self.actionShow_CCPL = QAction(self)
     self.action_Solve = QAction(self)
     self.action_CCPL = QAction(self)
     self.action_Help = QAction(self)
     menu_File.addAction(self.action_New)
     menu_File.addAction(self.action_Open)
     menu_File.addAction(self.actionSave_As)
     menu_File.addAction(self.action_Save)
     menu_File.addSeparator()
     menu_File.addAction(self.action_Quit)
     self.menu_Solve.addAction(self.action_Solve)
     self.menu_Help.addAction(self.action_About)
     self.menu_Help.addAction(self.action_CCPL)
     self.menu_Help.addAction(self.action_Help)
     menubar.addAction(menu_File.menuAction())
     menubar.addAction(self.menu_Solve.menuAction())
     menubar.addAction(self.menu_Help.menuAction())        
     self.setWindowTitle("Main Window")
     self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab),\
                                "Data Page")
     self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2),\
                                "Solution Page")        
     menu_File.setTitle("&File")        
     self.menu_Solve.setTitle("&Solve")
     self.menu_Help.setTitle("&Help")
     self.tabWidget.setCurrentIndex(0)
     self.action_New.setText("&New") 
     self.action_Open.setText("&Open")       
     self.actionSave_As.setText("Save &As")
     self.action_Save.setText("&Save")
     self.action_Quit.setText("&Quit")        
     self.action_Solve.setText("&Solve")
     self.action_About.setText("&About")
     self.action_CCPL.setText("&CCPL")
     self.action_Help.setText("&Help")
     self.action_Quit.triggered.connect(self.close)
     allToolBar = self.addToolBar("AllToolBar") 
     allToolBar.setObjectName("AllToolBar") 
     self.addActions(allToolBar, (self.action_Open, self.actionSave_As,\
                     self.action_Save, self.action_Solve,\
                     self.action_Quit ))
     self.action_New.triggered.connect(self.fileNew)
     self.action_Open.triggered.connect(self.fileOpen)
     self.actionSave_As.triggered.connect(self.fileSaveAs)
     self.action_Save.triggered.connect(self.fileSave)
     self.action_Solve.triggered.connect(self.trussSolve)
     self.action_About.triggered.connect(self.aboutBox)
     self.action_CCPL.triggered.connect(self.displayCCPL)
     self.action_Help.triggered.connect(self.help)
     self.plainTextEdit.textChanged.connect(self.setDirty)
     self.action_New = self.editAction(self.action_New, None,\
                         'ctrl+N', 'filenew', 'New File.')   
     self.action_Open = self.editAction(self.action_Open, None, 
                         'ctrl+O', 'fileopen', 'Open File.')
     self.actionSave_As = self.editAction(self.actionSave_As,\
                         None, 'ctrl+A', 'filesaveas',\
                         'Save and Name File.')
     self.action_Save = self.editAction(self.action_Save, None, 
                         'ctrl+S', 'filesave', 'Save File.')
     self.action_Solve = self.editAction(self.action_Solve, None, 
#.........这里部分代码省略.........
开发者ID:Averroes,项目名称:tuts4pyside,代码行数:103,代码来源:truss.py

示例13: ScriptSetVal

# 需要导入模块: from PySide.QtGui import QFont [as 别名]
# 或者: from PySide.QtGui.QFont import setPointSize [as 别名]
class ScriptSetVal(QMainWindow):
    def __init__(self, tabID, subWinHandle, parent=None):
        super(ScriptSetVal,  self).__init__(parent)
        self.tabID = tabID    
        self.subWinHandle = subWinHandle
        self.tableHandle  = subWinHandle.widget().centralWidget()
        self.initUI()
        self.initToolBar()
        self.initDocker()
        
    def initUI(self): 
        self.t = QTextEdit()
        self.initFont()
        self.setCentralWidget(self.t)
        self.setGeometry(QRect(200, 200, 410, 610))
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.show()
    
    def initToolBar(self):
        self.scriptbar    = QToolBar('plot options') 
        self.addToolBar( Qt.BottomToolBarArea , self.scriptbar)
        scriptAction = QAction('set script', self)
        self.scriptbar.addAction(scriptAction)
        scriptAction.triggered.connect(self.RelectRng)

    def initFont(self):
        self.tabStop = 4
        self.font = QFont('Courier')
        self.metrics = QFontMetrics(self.font)
        self.t.setTabStopWidth(self.tabStop * self.metrics.width(' '));
        self.font.setStyleHint(QFont.Monospace);
        self.font.setFixedPitch(True);
        self.font.setPointSize(12)
        self.p = self.t.palette()
        self.p.setColor(QPalette.Base, QColor(0, 0, 0))
        self.p.setColor(QPalette.Text, QColor(255, 255, 255))
        self.t.setPalette(self.p)
        self.t.setFont(self.font)
        self.highlighter = Highlighter(self.t.document())

    def initDocker(self):
        self.elog = QTextEdit()
        self.elogDockWidget = QDockWidget("  ::  error log ::", self)
        self.elogDockWidget.setFeatures(QDockWidget.DockWidgetMovable)
        self.elogDockWidget.setAllowedAreas(Qt.TopDockWidgetArea and Qt.BottomDockWidgetArea)
        self.addDockWidget(Qt.BottomDockWidgetArea, self.elogDockWidget)
        self.elogDockWidget.setWidget(self.elog)
        self.p = self.elog.palette()
        self.p.setColor(QPalette.Base, QColor(0, 0, 0))
        self.p.setColor(QPalette.Text, QColor(255, 0, 0))
        self.elog.setPalette(self.p)
        self.elog.setReadOnly(True)

          

    def RelectRng(self):
        try:
            self.selectAry = []
            if len(self.tableHandle.selectedRanges()) != 0:
                for i in range( len(self.tableHandle.selectedRanges())):
                    self.leftCol  = self.tableHandle.selectedRanges()[i].leftColumn()
                    self.colCount = self.tableHandle.selectedRanges()[i].columnCount()
                    for currentCol in range( self.leftCol, self.leftCol + self.colCount ):
                        self.selectAry.append( currentCol )
                self.leftCol  = self.tableHandle.selectedRanges()[0].leftColumn()
                self.colCount = self.tableHandle.selectedRanges()[0].columnCount()
                self.topRow   = self.tableHandle.selectedRanges()[0].topRow()
                self.rowCount = self.tableHandle.selectedRanges()[0].rowCount()
                
                rows = []
                cols = []
                for i in range(self.topRow,  self.topRow  + self.rowCount, 1):
                    rows.append(i)
                for i in range(self.leftCol, self.leftCol + self.colCount, 1):
                    cols.append(i)

                try:
                    exec(self.t.toPlainText())
                except Exception, e:
                    self.elog.moveCursor(QTextCursor.End)
                    self.elog.textCursor().insertHtml('<span style="color:#FF0000">Error: '+str(e)+'</span><br>')
                    

                    print str(e)
            else:
开发者ID:s910324,项目名称:Sloth,代码行数:87,代码来源:NightlyBuild-0613-plot_cluster_fixed.py

示例14: LevelDetailsView

# 需要导入模块: from PySide.QtGui import QFont [as 别名]
# 或者: from PySide.QtGui.QFont import setPointSize [as 别名]
class LevelDetailsView(QFrame):
    """ Represents the View of the Level Details """
    DEFENSE_ORDER = [Mine, ReverseMine, FragileMine, Worm, AntiDroneMine]

    def __init__(self, levelSelection, parent=None):
        """ Initialize the Level Details View """
        QFrame.__init__(self, parent)

        #self.resize(self.WIDTH, self.HEIGHT)
        self.levelSelection = levelSelection
        
        self.smallFont = QFont()
        self.smallFont.setPointSize(14)
        
        self.bigFont = QFont()
        self.bigFont.setPointSize(24)
        
        self.detailsLabel = self.getLabel("Level Details", self.bigFont, alignment=Qt.AlignCenter)
        self.detailsLabel.move(32, 16)
        self.setupGridLabel()
        self.setupDefensesLabels()
        self.setupRatingsLabel()
        
    def getLabel(self, text, font, alignment=None):
        """ Get a Level Label with the text """
        label = QLabel(text, self)
        label.setFont(font)
        if alignment:
            label.setAlignment(alignment)
        return label
        
    def setupGridLabel(self):
        """ Setup the Grid Label """
        self.gridLabel = self.getLabel("", self.smallFont)
        self.gridLabel.move(32, 48+16)
        self.gridLabel.resize(200, 32)
        
    def setupRatingsLabel(self):
        """ Setup the Ratings Label """
        self.ratingsLabel = self.getLabel("", self.smallFont)
        self.ratingsLabel.move(32, 48+16)
        self.ratingsLabel.resize(200, 32)
        
    def setupDefensesLabels(self):
        """ Setup the Remaining Defenses Labels """
        self.defensesLabels = {}
        
        for defenseClass in self.DEFENSE_ORDER:
            label = self.getLabel("", self.smallFont)
            label.setVisible(False)
            label.resize(200, 32)
            self.defensesLabels[defenseClass] = label
        
    def updateView(self):
        """ Update the View """
        self.updateGridLabel()
        self.updateDefenseLabels()
        self.updateRatingsLabel()
        self.update()
        
    def updateGridLabel(self):
        """ Update the Grid Label """
        level = self.levelSelection.getLevel()
        self.gridLabel.setText("{0} x {1}".format(level.rows, level.columns))
        
    def updateDefenseLabels(self):
        """ Update the Defense Label """
        defenses = self.levelSelection.getLevel().defenses
        labelNumber = 1
        for defenseClass in self.DEFENSE_ORDER:
            label = self.defensesLabels[defenseClass]
            if defenseClass in defenses:
                label.setVisible(True)
                label.setText("{0}: {1}".format(defenseClass.friendlyName, defenses[defenseClass]))
                label.move(32, 48+32*(labelNumber+1))
                labelNumber += 1
            else:
                label.setVisible(False)
                
    def updateRatingsLabel(self):
        """ Update the Ratings Label """
        self.ratingsLabel.move(32, 48+32*(len(self.levelSelection.getLevel().defenses)+3))
        
        text = ""
        if CURRENT_PROFILE.completedLevel(self.levelSelection.getLevel()):
            text += "C"
        if CURRENT_PROFILE.acheivedMoveAwardOnLevel(self.levelSelection.getLevel()):
            text += "M"
        if CURRENT_PROFILE.acheivedPowerAwardOnLevel(self.levelSelection.getLevel()):
            text += "P"
        self.ratingsLabel.setText(text)
开发者ID:cloew,项目名称:PyMine,代码行数:93,代码来源:level_details_view.py

示例15: GameStatusView

# 需要导入模块: from PySide.QtGui import QFont [as 别名]
# 或者: from PySide.QtGui.QFont import setPointSize [as 别名]
class GameStatusView(QFrame):
    """ It's the game status view """
    
    def __init__(self, level, width, height, parent=None):
        """  """
        QFrame.__init__(self, parent)
        self.level = level
        
        self.setup()
        
        self.updateView()
        self.color = QColor(200, 200, 200)
        self.setStyleSheet("QFrame { background-color: %s }" % self.color.name()) 
        self.resize(width, height)
        
    def setup(self):
        """ Setup the View """
        self.setupFont()
        self.setupPowerLabel()
        self.setupMovesLabel()
        self.setupRemainingDefensesLabels()
        
    def setupFont(self):
        """ Setup the Font """
        self.font = QFont()
        self.font.setPointSize(14)
        
    def setupPowerLabel(self):
        """ Setup the Power Label """
        self.powerLabel = QLabel("", self)
        self.powerLabel.move(32, 16)
        self.powerLabel.setFont(self.font)
        
    def setupMovesLabel(self):
        """ Setup the Moves Label """
        self.movesLabel = QLabel("", self)
        self.movesLabel.move(32, 16+48)
        self.movesLabel.setFont(self.font)
        
    def setupRemainingDefensesLabels(self):
        """ Setup the Remaining Defenses Labels """
        self.remainingDefensesLabels = {}
        labelNumber = 1
        remainingDefenses = self.level.getRemainingDefenses()
        for defenseClass in remainingDefenses:
            label = QLabel("", self)
            label.move(32, 16+48*(labelNumber+1))
            label.setFont(self.font)
            self.remainingDefensesLabels[defenseClass] = label
            labelNumber += 1
        
    def updateView(self):
        """ Update the View """
        self.updatePowerLabel()
        self.updateMovesLabel()
        self.updateRemainingDefensesLabels()
        
    def updatePowerLabel(self):
        """ Update the Power Label """
        self.powerLabel.setText("Power: {0}".format(self.level.drone.powerRating.power))
        
    def updateMovesLabel(self):
        """ Update the Moves Label """
        self.movesLabel.setText("Moves: {0}".format(self.level.moveRating.moveCount))
        self.movesLabel.resize(self.movesLabel.contentsRect().width(), self.movesLabel.contentsRect().height())
        
    def updateRemainingDefensesLabels(self):
        """ Update the Remaining Mines Label """
        remainingDefenses = self.level.getRemainingDefenses()
        
        for defenseClass in remainingDefenses:
            label = self.remainingDefensesLabels[defenseClass]
            label.setText("{0} Left: {1}".format(defenseClass.friendlyName, remainingDefenses[defenseClass]))
开发者ID:cloew,项目名称:PyMine,代码行数:75,代码来源:game_status_view.py


注:本文中的PySide.QtGui.QFont.setPointSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。