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


Python QtCore.QString方法代码示例

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


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

示例1: update_ui

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QString [as 别名]
def update_ui(self, move_point=True):
        if self.ui_mode == 'none':
            return False
        is_predict = False
        snap_qcolor = self.calibrate_color(self.user_color, self.pos)
        self.color = snap_qcolor
        self.emit(SIGNAL('update_color'), QString('background-color: %s' % self.color.name()))

        if self.ui_mode == 'point':
            if move_point:
                self.uiControl.movePoint(self.pos, snap_qcolor, self.user_color, self.brushWidth)
            else:
                self.user_color, self.brushWidth, isNew = self.uiControl.addPoint(self.pos, snap_qcolor, self.user_color, self.brushWidth)
                if isNew:
                    is_predict = True
                    # self.predict_color()

        if self.ui_mode == 'stroke':
            self.uiControl.addStroke(self.prev_pos, self.pos, snap_qcolor, self.user_color, self.brushWidth)
        if self.ui_mode == 'erase':
            isRemoved = self.uiControl.erasePoint(self.pos)
            if isRemoved:
                is_predict = True
                # self.predict_color()
        return is_predict 
开发者ID:junyanz,项目名称:interactive-deep-colorization,代码行数:27,代码来源:gui_draw.py

示例2: readSettings

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QString [as 别名]
def readSettings(self):
        settings = QtCore.QSettings("Arabeyes.org", "Qutrub")
        try:
            family=settings.value("font_base_family", QtCore.QVariant(QString("Traditional Arabic"))).toString()
            size,ok=settings.value("font_base_size", QtCore.QVariant(12)).toInt();
            bold=settings.value("font_base_bold", QtCore.QVariant(True)).toBool()
            dictsetting,ok=settings.value("DictSetting", QtCore.QVariant(1)).toInt();
        except TypeError:
            family=settings.value("font_base_family", "Traditional Arabic")
            size=settings.value("font_base_size", "12")
            size= int(size)
            ok = bool(size)
            bold=settings.value("font_base_bold", True)
            bold = bool(bold)
            dictsetting =settings.value("DictSetting", "1")
            dictsetting = int(dictsetting)
        if not ok:size=12;
        self.font_result.setFamily(family)
        self.font_result.setPointSize(size)
        self.font_result.setBold(bold)
        #read of dictsetting options
        
        if not ok:dictsetting=1;

##        self.BDictSetting.setCheckState(dictsetting); 
开发者ID:linuxscout,项目名称:mishkal,代码行数:27,代码来源:setting.py

示例3: setupHistoryList

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QString [as 别名]
def setupHistoryList(self):
        self.table.clear()
        conn = sqlite3.connect('youdao-anki.db')
        cursor = conn.cursor()
        cursor.execute("select * from history where deckname='%s' order by id desc" % self.deckList.currentText())
        values = cursor.fetchall()
        cursor.close()
        conn.close()
        # values[number of raw][0->id,1->terms,2->time]
        self.table.setColumnCount(2)
        self.table.setRowCount(len(values))
        self.table.setHorizontalHeaderLabels(QString("Mark;Time;").split(";"))
        for index, day in enumerate(values):
            self.table.setItem(index, 1, QTableWidgetItem(str(day[2])))
            mark = day[3]
            if mark is None:
                mark = 'N'
            self.table.setItem(index, 0, QTableWidgetItem(mark))
        self.debug.appendPlainText('187: get sync history') 
开发者ID:megachweng,项目名称:Anki-Youdao,代码行数:21,代码来源:Youdao-Anki.py

示例4: __setitem__

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QString [as 别名]
def __setitem__(self, key, value):
		isDate = False
		if isinstance(value, QDate):
			value = value.toString('MM/dd/yyyy')
			isDate = True
		elif isinstance(value, date):
			value = value.strftime('%m/%d/%Y')
			isDate = True
		elif not isinstance(value, (float, int, str, unicode, QString)):
			value = repr(value)
		# addProperty is also setProperty
		if isDate:
			mxs.fileProperties.addProperty(self.customName, key, value, mxs.pyhelper.namify('date'))
		else:
			mxs.fileProperties.addProperty(self.customName, key, value)
		self.emitChange(key) 
开发者ID:blurstudio,项目名称:cross3d,代码行数:18,代码来源:studiomaxuserprops.py

示例5: paintEvent

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QString [as 别名]
def paintEvent(self, event):
        painter = QtGui.QPainter(self)
        painter.setRenderHints(QtGui.QPainter.Antialiasing)

        painter.fillRect(QtCore.QRectF(50, 50, 200, 200), QtGui.QBrush(QtGui.QColor(QtGui.QColor(110, 110, 110))))
        painter.fillRect(QtCore.QRectF(50, 50, 200, 200), QtGui.QBrush(QtCore.Qt.CrossPattern))

        painter.setPen(QtGui.QPen(QtGui.QColor(QtCore.Qt.lightGray), 2, QtCore.Qt.SolidLine))
        path = QtGui.QPainterPath()
        path.moveTo(50, 250)
        path.cubicTo(self.points[0][0], self.points[0][1], self.points[1][0], self.points[1][1], 250, 50)
        painter.drawPath(path)

        painter.setBrush(QtGui.QBrush(QtGui.QColor(QtCore.Qt.darkCyan)))
        painter.setPen(QtGui.QPen(QtGui.QColor(QtCore.Qt.lightGray), 1))


        #for x, y in pts:
        painter.drawEllipse(QtCore.QRectF(self.points[0][0] - 4, self.points[0][1] - 4, 8, 8))
        painter.drawEllipse(QtCore.QRectF(self.points[1][0] - 4, self.points[1][1] - 4, 8, 8))
        painter.setPen(QtGui.QPen(QtGui.QColor(QtCore.Qt.white), 1))
        label1 = "("+ str((self.points[0][0] - 50)/2) + "," + str(100 - ((self.points[0][1] -50)/2)) + ")"
        painter.drawText(self.points[0][0] -25, self.points[0][1] + 18, QtCore.QString(label1))
        label2 = "("+ str((self.points[1][0] - 50)/2) + "," + str(100 - ((self.points[1][1] -50)/2)) + ")"
        painter.drawText(self.points[1][0] -25, self.points[1][1] + 18, QtCore.QString(label2)) 
开发者ID:tb2097,项目名称:wacom-gui,代码行数:27,代码来源:pressure.py

示例6: set_color

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QString [as 别名]
def set_color(self, c_rgb):
        c = QColor(c_rgb[0], c_rgb[1], c_rgb[2])
        self.user_color = c
        snap_qcolor = self.calibrate_color(c, self.pos)
        self.color = snap_qcolor
        self.emit(SIGNAL('update_color'), QString('background-color: %s' % self.color.name()))
        self.uiControl.update_color(snap_qcolor, self.user_color)
        self.compute_result() 
开发者ID:junyanz,项目名称:interactive-deep-colorization,代码行数:10,代码来源:gui_draw.py

示例7: readSettings

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QString [as 别名]
def readSettings(self):
        settings = QtCore.QSettings("Arabeyes.org", "Qutrub")
        try:
            family=settings.value("font_base_family", QtCore.QVariant(QString("Traditional Arabic"))).toString()
        except TypeError:
            family = str(settings.value("font_base_family", "Traditional Arabic"))
        try:
            size,ok=settings.value("font_base_size", QtCore.QVariant(12)).toInt();
        except TypeError:
            size = settings.value("font_base_size", 12)
            size = int(size)
            ok = bool(size)
            
        if not ok:size=12;
        try:
            bold=settings.value("font_base_bold", QtCore.QVariant(True)).toBool()
        except TypeError:
            bold= bool(settings.value("font_base_bold", True))
        self.font_result.setFamily(family)
        self.font_result.setPointSize(size)
        self.font_result.setBold(bold)
        #read of dictsetting options
        try:
            dictsetting,ok = settings.value("DictSetting", QtCore.QVariant(1)).toInt();
        except TypeError:
            dictsetting = settings.value("DictSetting", 1);
            ok = bool(dictsetting)
        if not ok:dictsetting=1;

        self.BDictOption=dictsetting; 
开发者ID:linuxscout,项目名称:mishkal,代码行数:32,代码来源:appgui.py

示例8: send_command

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QString [as 别名]
def send_command(self, message=None, *args):
        if not message:
            commands = unicode(self.command.text()).encode("iso-8859-1").split()
            if not commands:
                core.log.warn("No command")
                return
            else:
                message, args = commands[0], commands[1:]

        args = [(unicode(arg) if isinstance(arg, QtCore.QString) else arg) for arg in args]
        command = "%s %s" % (message, " ".join(str(arg) for arg in args))
        core.log.debug("send_command: %s", command)
        if hasattr(self, "command"):
            self.command.setText(command)
        self.instructions.put(message, *args) 
开发者ID:tjguk,项目名称:networkzero,代码行数:17,代码来源:quiz-controller.py

示例9: ustr

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QString [as 别名]
def ustr(x):
    '''py2/py3 unicode helper'''

    if sys.version_info < (3, 0, 0):
        from PyQt4.QtCore import QString
        if type(x) == str:
            return x.decode('utf-8')
        if type(x) == QString:
            return unicode(x)
        return x
    else:
        return x  # py3 
开发者ID:zihuaweng,项目名称:Interactive-image-segmentation-opencv-qt,代码行数:14,代码来源:ustr.py

示例10: set_dark_style

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QString [as 别名]
def set_dark_style(onoff):
    if (onoff):
        stylefile = core.QFile("qstyle.qss")
        stylefile.open(core.QFile.ReadOnly)
        if qt5:
            StyleSheet = str(stylefile.readAll())
        else:
            StyleSheet = core.QString(core.QLatin1String(stylefile.readAll()))
    else:
        StyleSheet = ""

    app.setStyleSheet(StyleSheet) 
开发者ID:cedricp,项目名称:ddt4all,代码行数:14,代码来源:ddt4all.py

示例11: drawStats

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QString [as 别名]
def drawStats(self, qp):
        defaultCol = QColor(0,255,0, 200)

        #qp = QtGui.QPainter()
        qp.resetTransform()
        w = self.width()
        h = self.height()

        top = 50
        bottom = h-50
        width, height = w*0.2, 22
        dist = 10
        space = height+dist
        pos = width/4


        # DRAW PROGRESS BAGS (left)
        if self.bat>-1:
            self.drawBar(qp, QRectF(pos, top+space*0, width,height), defaultCol, 'BAT %4.2fV'%(self.bat/1000.), self.bat, 3000, 4150)
        if self.link>-1:
            self.drawBar(qp, QRectF(pos, top+space*1, width,height), defaultCol, 'SIG %03d%%'%self.link, self.link)
        if self.cpu>-1:
            self.drawBar(qp, QRectF(pos, top+space*2, width,height), defaultCol, 'CPU %03d%%'%self.cpu, self.cpu)



        # DRAW RAW STATS( right)
        pos = w-width/4-width/2
        space = height+2

        if self.pktsOut>-1:
            qp.drawText(QRectF(pos, top+space*0, width,height), Qt.AlignLeft, '%04d kb/s'%self.pktsOut)
        if self.pktsIn>-1:
            qp.drawText(QRectF(pos, top+space*1, width,height), Qt.AlignLeft, '%04d kb/s'%self.pktsIn)

        if self.pressure>-1:
            qp.drawText(QRectF(pos, top+space*3, width,height), Qt.AlignLeft, '%06.2f hPa'%self.pressure)
        if self.temp>-1:
            qp.drawText(QRectF(pos, top+space*4, width,height), Qt.AlignLeft, QString('%05.2f'%self.temp)+QChar(0260)+QString("C"))
        if self.aslLong>-1:
            qp.drawText(QRectF(pos, top+space*5, width,height), Qt.AlignLeft, '%4.2f m'%self.aslLong) 
开发者ID:omwdunkley,项目名称:crazyflieROS,代码行数:43,代码来源:ai.py

示例12: _toNativeValue

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QString [as 别名]
def _toNativeValue(self, pyValue):
		"""
			\remarks	[virtual] 	converts the inputed value from Qt/Python to whatever value is required for the native application
			\param		pyValue	<variant>
			\return		<variant>
		"""
		from PyQt4.QtCore import QString

		# we should not pass back QString value's to an application, as they will not expect it.  Standard python strings/unicodes will be auto-converted
		if (type(pyValue) == QString):
			return unicode(pyValue)

		# by default, we assume that any other type can be naturally processed
		return pyValue 
开发者ID:blurstudio,项目名称:cross3d,代码行数:16,代码来源:abstractscene.py

示例13: property

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QString [as 别名]
def property(self, key, default=None):
		"""
			\remarks	returns a global scene value
			\param		key			<str> || <QString>
			\param		default		<variant>	default value to return if no value was found
			\return		<variant>
		"""
		return default 
开发者ID:blurstudio,项目名称:cross3d,代码行数:10,代码来源:abstractscene.py

示例14: setProperty

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QString [as 别名]
def setProperty(self, key, value):
		"""
			\remarks	sets the global scene property to the inputed value
			\param		key			<str> || <QString>
			\param		value		<variant>
			\return		<bool>
		"""
		return False 
开发者ID:blurstudio,项目名称:cross3d,代码行数:10,代码来源:abstractscene.py

示例15: parse

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import QString [as 别名]
def parse(self, xmlString):
		success = False
		if isinstance(xmlString, QString):
			xmlString = unicode(xmlString)
		else:
			xmlString = xmlString.encode('utf-8')
		if (xmlString):
			tempObject = xml.dom.minidom.parseString(xmlString)
			if (tempObject):
				self._object = tempObject
				success = True
		return success 
开发者ID:blurstudio,项目名称:cross3d,代码行数:14,代码来源:xmldocument.py


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