本文整理匯總了Python中PyQt4.QtGui.QDialog方法的典型用法代碼示例。如果您正苦於以下問題:Python QtGui.QDialog方法的具體用法?Python QtGui.QDialog怎麽用?Python QtGui.QDialog使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt4.QtGui
的用法示例。
在下文中一共展示了QtGui.QDialog方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: doSettings
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QDialog [as 別名]
def doSettings(millisecWait, depth, fontSize):
global ui
Dialog = QtGui.QDialog()
settings = uic.loadUi(os.path.join(os.path.dirname(__file__), "./ui/settings.ui"), baseinstance=Dialog)
ui = settings
Dialog.setModal(True)
QtCore.QObject.connect(settings.lineEditNfSamples, QtCore.SIGNAL('textChanged (const QString&)'), onChange)
QtCore.QObject.connect(settings.lineEditTimesSecond, QtCore.SIGNAL('textChanged (const QString&)'), onChange)
ui.lineEditTimesSecond.setText(str(float(1000.0 / (millisecWait * 1.0))))
ui.lineEditNfSamples.setText(str(depth))
ui.lineEditFontSize.setText(str(fontSize))
Dialog.exec_()
millisecWait = int(1000.0 / float(str(ui.lineEditTimesSecond.displayText())))
depth = int(str(ui.lineEditNfSamples.displayText()))
fontSize = int(str(ui.lineEditFontSize.displayText()))
return(millisecWait, depth, fontSize)
示例2: __init__
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QDialog [as 別名]
def __init__(self,parent = None):
QtGui.QDialog.__init__(self, parent)
self.parent = parent
self.formats = ["%A, %d. %B %Y %H:%M",
"%A, %d. %B %Y",
"%d. %B %Y %H:%M",
"%d.%m.%Y %H:%M",
"%d. %B %Y",
"%d %m %Y",
"%d.%m.%Y",
"%x",
"%X",
"%H:%M"]
self.initUI()
示例3: get_code
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QDialog [as 別名]
def get_code(url, size=(640, 480), title="Google authentication"):
"""Open a QT webkit window and return the access code."""
app = QtGui.QApplication([])
dialog = QtGui.QDialog()
dialog.setWindowTitle(title)
dialog.resize(*size)
webview = QtWebKit.QWebView()
webpage = QtWebKit.QWebPage()
webview.setPage(webpage)
webpage.loadFinished.connect(lambda: _on_qt_page_load_finished(dialog, webview))
webview.setUrl(QtCore.QUrl.fromEncoded(url))
layout = QtGui.QGridLayout()
layout.addWidget(webview)
dialog.setLayout(layout)
dialog.authorization_code = None
dialog.show()
app.exec_()
return dialog.authorization_code
示例4: __init__
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QDialog [as 別名]
def __init__(self):
"""
Initializes a new instance of this class.
"""
QtGui.QDialog.__init__(self)
self.initUI()
#region Instance fields
self.encodings = []
"""Temporary list of encodings that is being edited"""
self.encodingsChanged = False
"""Flag to indicate if encodings list was edited"""
#endregion
#endregion
#region Methods
示例5: __init__
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QDialog [as 別名]
def __init__(self):
"""
Initializes a new instance of this class.
"""
QtGui.QDialog.__init__(self)
self.initUI()
#region Instance fields
self.encodingIdx = -1
"""Index of the encoding that is being edited. If index is -1 the user is creating a new encoding."""
self.encodings = []
"""Temporary list of encodings that is being edited"""
#endregion
#endregion
#region Methods
示例6: setupWin
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QDialog [as 別名]
def setupWin(self):
self.setWindowTitle("UITranslator" + " - v" + self.version)
self.setGeometry(300, 300, 300, 300)
# win icon setup
path = os.path.join(os.path.dirname(self.location),'icons','UITranslator.png')
self.setWindowIcon(QtGui.QIcon(path))
# initial win drag position
self.drag_position=QtGui.QCursor.pos()
#self.resize(250,250)
# - for frameless or always on top option
#self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) # it will keep ui always on top of desktop, but to set this in Maya, dont set Maya as its parent
#self.setWindowFlags(QtCore.Qt.FramelessWindowHint) # it will hide ui border frame, but in Maya, use QDialog instead as QMainWindow will disappear
#self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint) # best for Maya case with QDialog without parent, for always top frameless ui
# - for transparent and non-regular shape ui
#self.setAttribute(QtCore.Qt.WA_TranslucentBackground) # use it if you set main ui to transparent and want to use alpha png as irregular shape window
#self.setStyleSheet("background-color: rgba(0, 0, 0,0);") # black color better white color for get better look of semi trans edge, like pre-mutiply
示例7: setupWin
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QDialog [as 別名]
def setupWin(self):
self.setWindowTitle("TMP_UniversalToolUI_TND" + " - v" + self.version)
self.setGeometry(300, 300, 800, 600)
# win icon setup
path = os.path.join(os.path.dirname(self.location),'icons','TMP_UniversalToolUI_TND.png')
self.setWindowIcon(QtGui.QIcon(path))
# initial win drag position
self.drag_position=QtGui.QCursor.pos()
#self.resize(250,250)
# - for frameless or always on top option
#self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) # it will keep ui always on top of desktop, but to set this in Maya, dont set Maya as its parent
#self.setWindowFlags(QtCore.Qt.FramelessWindowHint) # it will hide ui border frame, but in Maya, use QDialog instead as QMainWindow will disappear
#self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint) # best for Maya case with QDialog without parent, for always top frameless ui
# - for transparent and non-regular shape ui
#self.setAttribute(QtCore.Qt.WA_TranslucentBackground) # use it if you set main ui to transparent and want to use alpha png as irregular shape window
#self.setStyleSheet("background-color: rgba(0, 0, 0,0);") # black color better white color for get better look of semi trans edge, like pre-mutiply
示例8: __init__
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QDialog [as 別名]
def __init__(self, settings):
QtGui.QDialog.__init__(self)
# Set up the user interface from Designer.
self.setupUi(self)
# internal GUI signals
self.axialThresholdEdit.editingFinished.connect(self.checkSettingsValues)
self.axialMinimumEdit.editingFinished.connect(self.checkSettingsValues)
self.unlinksThresholdEdit.editingFinished.connect(self.checkSettingsValues)
self.linksThresholdEdit.editingFinished.connect(self.checkSettingsValues)
self.closeButtonBox.accepted.connect(self.updateSettings)
self.closeButtonBox.rejected.connect(self.restoreSettings)
# hide unused UI buttons
self.linksThresholdLabel.hide()
self.linksThresholdEdit.hide()
#
self.ok = self.closeButtonBox.button(QtGui.QDialogButtonBox.Ok)
self.settings = settings
self.restoreSettings()
示例9: __init__
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QDialog [as 別名]
def __init__(self,parent = None):
QtGui.QDialog.__init__(self, parent)
self.parent = parent
self.initUI()
示例10: __init__
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QDialog [as 別名]
def __init__(self, parent = None, forEditing = False):
QtGui.QDialog.__init__(self,parent)
self.parent = parent
self.cursor = self.parent.text.textCursor()
self.forEditing = forEditing
self.initUI()
示例11: __init__
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QDialog [as 別名]
def __init__(self, parent = None):
QtGui.QDialog.__init__(self, parent)
self.parent = parent
self.lastStart = 0
self.initUI()
示例12: __init__
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QDialog [as 別名]
def __init__(self, parent=None):
QtGui.QDialog.__init__(self, parent)
self.resize(500, 200)
self.setWindowTitle(u'網絡適配器選擇')
screen = QtGui.QDesktopWidget().screenGeometry()
size = self.geometry()
self.move((screen.width()-size.width())/2, (screen.height()-size.height())/2)
self.initUI()
self.show()
示例13: print_result
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QDialog [as 別名]
def print_result(self):
if "HTML" in self.result:
data=QtCore.QFile("ar/style.css");
if (data.open(QtCore.QFile.ReadOnly)):
mySTYLE_SHEET=QtCore.QTextStream(data).readAll();
## text=unicode(text);
else:
mySTYLE_SHEET=u"""
body {
direction: rtl;
font-family: Traditional Arabic, "Times New Roman";
font-size: 16pt;
}
"""
document = QtGui.QTextDocument("")
document.setDefaultStyleSheet(mySTYLE_SHEET)
self.result["HTML"]=u"<html dir=rtl><body dir='rtl'>"+self.result["HTML"]+"</body></html>"
document.setHtml(self.result["HTML"]);
printer = QtGui.QPrinter()
dlg = QtGui.QPrintDialog(printer, self.centralwidget)
if dlg.exec_() != QtGui.QDialog.Accepted:
return
self.ResultVocalized.print_(printer)
else:
QtGui.QMessageBox.warning(self.centralwidget,U"خطأ",
u"لا شيء يمكن طبعه.")
示例14: set_setting
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QDialog [as 別名]
def set_setting(self):
init_Dialog=QtGui.QDialog(self.centralwidget)
Dialog=Ui_Dialog();
Dialog.setupUi(init_Dialog);
if init_Dialog.exec_() == QtGui.QDialog.Accepted:
self.readSettings();
self.applySettings();
示例15: manual
# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QDialog [as 別名]
def manual(self):
data=QtCore.QFile("ar/help_body.html");
if (data.open(QtCore.QFile.ReadOnly)):
textstream=QtCore.QTextStream(data);
textstream.setCodec("UTF-8");
text=textstream.readAll();
else:
text=u"لا يمكن فتح ملف المساعدة"
Dialog=QtGui.QDialog(self.centralwidget)
Dialog.setObjectName("Dialog")
Dialog.resize(480, 480)
Dialog.setWindowTitle(u'دليل الاستعمال')
gridLayout = QtGui.QGridLayout(Dialog)
gridLayout.setObjectName("gridLayout")
textBrowser = QtGui.QTextBrowser(Dialog)
textBrowser.setObjectName("textBrowser")
gridLayout.addWidget(textBrowser, 0, 0, 1, 1)
buttonBox = QtGui.QDialogButtonBox(Dialog)
buttonBox.setOrientation(QtCore.Qt.Horizontal)
buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok)
buttonBox.setObjectName("buttonBox")
gridLayout.addWidget(buttonBox, 1, 0, 1, 1)
QtCore.QObject.connect(buttonBox, QtCore.SIGNAL("accepted()"), Dialog.accept)
QtCore.QMetaObject.connectSlotsByName(Dialog)
text2=unicode(text)
textBrowser.setText(text2)
RightToLeft=1;
Dialog.setLayoutDirection(RightToLeft);
Dialog.show();