Python PyQt4.QtGui.QDialog() Examples

The following are 30 code examples of PyQt4.QtGui.QDialog(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module PyQt4.QtGui , or try the search function .
Example #1
Source File: settings.py    From procexp with GNU General Public License v3.0 8 votes vote down vote up
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) 
Example #2
Source File: universal_tool_template_v7.3.py    From universal_tool_template.py with MIT License 6 votes vote down vote up
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 
Example #3
Source File: datetime.py    From Writer with MIT License 6 votes vote down vote up
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() 
Example #4
Source File: node_sensor_encoding_form.py    From nupic.studio with GNU General Public License v2.0 6 votes vote down vote up
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 
Example #5
Source File: browser.py    From shoogle with GNU General Public License v3.0 6 votes vote down vote up
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 
Example #6
Source File: node_sensor_form.py    From nupic.studio with GNU General Public License v2.0 6 votes vote down vote up
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 
Example #7
Source File: UITranslator_v1.0.py    From universal_tool_template.py with MIT License 6 votes vote down vote up
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 
Example #8
Source File: VerificationSettingsDialog.py    From qgisSpaceSyntaxToolkit with GNU General Public License v3.0 6 votes vote down vote up
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() 
Example #9
Source File: racer_edit_dialog.py    From time_trial with MIT License 5 votes vote down vote up
def __init__(self, racer, parent = None, flags = QtCore.Qt.Dialog):
        QtGui.QDialog.__init__(self, parent, flags)

        self.racer = racer

        self.layout = QtGui.QVBoxLayout()
        self.setLayout(self.layout)

        form_layout = QtGui.QFormLayout()
        self.layout.addLayout(form_layout)

        self.name = QtGui.QLineEdit(text=racer.name)
        form_layout.addRow("Name", self.name)
        self.hostname = QtGui.QLineEdit(text=racer.hostname)
        form_layout.addRow("Hostname",self.hostname)
        self.location = QtGui.QLineEdit(text=racer.location)
        form_layout.addRow("Location",self.location)

        button_layout = QtGui.QHBoxLayout()
        save = QtGui.QPushButton(text="Save")
        save.released.connect(self.save)
        button_layout.addWidget(save)
        cancel = QtGui.QPushButton(text="Cancel")
        cancel.released.connect(self.reject)
        button_layout.addWidget(cancel)

        self.layout.addLayout(button_layout) 
Example #10
Source File: dialogs.py    From deosorg with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self):
        QtGui.QDialog.__init__(self)
        self.setupUi(self)
        self.pwEdit1.textChanged.connect(self.validatePw)
        self.pwEdit2.textChanged.connect(self.validatePw)
        self.showHideButton.clicked.connect(self.switchPwVisible) 
Example #11
Source File: qgpkgAbout.py    From qgpkg with MIT License 5 votes vote down vote up
def __init__(self, parent=None):
        QtGui.QDialog.__init__(self, None)
        self.setWindowFlags( self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint )

        # Todo: add support for translation
        self._initGui(parent) 
Example #12
Source File: GUIVersion.py    From lknovel with MIT License 5 votes vote down vote up
def __init__(self, parent=None):
        QtGui.QDialog.__init__(self, parent)
        self.setupUi(self)
        self.setFixedSize(320, 120)

        self.pushButton.clicked.connect(lambda: self.close()) 
Example #13
Source File: GUIVersion.py    From lknovel with MIT License 5 votes vote down vote up
def __init__(self, parent=None):
        QtGui.QDialog.__init__(self, parent)
        self.setupUi(self)
        self.setFixedSize(380, 200)

        self.pushButton.clicked.connect(lambda: self.close()) 
Example #14
Source File: universal_tool_template_0803.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def setupWin(self):
        self.setWindowTitle(self.name + " - v" + self.version + " - host: " + hostMode)
        self.setWindowIcon(self.icon)
        # initial win drag position
        self.drag_position=QtGui.QCursor.pos()
        
        self.setGeometry(500, 300, 250, 110) # self.resize(250,250)
        
        #------------------------------
        # template list: for frameless or always on top option
        #------------------------------
        # - template : keep ui always on top of all;
        # While in Maya, dont set Maya as its parent
        '''
        self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) 
        '''
        
        # - template: hide ui border frame; 
        # While in Maya, use QDialog instead, as QMainWindow will make it disappear
        '''
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
        '''
        
        # - template: best solution for Maya QDialog without parent, for always on-Top frameless ui
        '''
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint)
        '''
        
        # - template: for transparent and non-regular shape ui
        # note: use it if you set main ui to transparent, and want to use alpha png as irregular shape window
        # note: black color better than white for better look of semi trans edge, like pre-mutiply
        '''
        self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
        self.setStyleSheet("background-color: rgba(0, 0, 0,0);")
        '''
        
    #############################################
    # customized SUPER quick ui function for speed up programming
    ############################################# 
Example #15
Source File: dialogs.py    From deosorg with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self):
        QtGui.QDialog.__init__(self)
        self.setupUi(self)
        self.pb1.clicked.connect(self.pinpadPressed)
        self.pb2.clicked.connect(self.pinpadPressed)
        self.pb3.clicked.connect(self.pinpadPressed)
        self.pb4.clicked.connect(self.pinpadPressed)
        self.pb5.clicked.connect(self.pinpadPressed)
        self.pb6.clicked.connect(self.pinpadPressed)
        self.pb7.clicked.connect(self.pinpadPressed)
        self.pb8.clicked.connect(self.pinpadPressed)
        self.pb9.clicked.connect(self.pinpadPressed) 
Example #16
Source File: dialogs.py    From deosorg with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self):
        QtGui.QDialog.__init__(self)
        self.setupUi(self)
        self.masterEdit1.textChanged.connect(self.validate)
        self.masterEdit2.textChanged.connect(self.validate)
        self.pwFileEdit.textChanged.connect(self.validate)
        self.pwFileButton.clicked.connect(self.selectPwFile)
        self.validate() 
Example #17
Source File: aboutui.py    From procexp with GNU General Public License v3.0 5 votes vote down vote up
def doAboutWindow():
  """Make an about window"""
  icon = os.path.dirname(__file__) + "/ui/icon.png"
  dialog = QtGui.QDialog()
  about = uic.loadUi(os.path.join(os.path.dirname(__file__), "./ui/about.ui"), baseinstance=dialog)
  about.label.setPixmap(QtGui.QPixmap(icon))
  dialog.exec_() 
Example #18
Source File: ProjectManager.py    From qgisSpaceSyntaxToolkit with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, iface, proj_settings, settings):

        QtGui.QDialog.__init__(self)

        # Set up the user interface from Designer.
        self.setupUi(self)

        self.iface = iface
        self.settings = settings
        self.proj_settings = proj_settings
        self.datastores = dict()
        self.datastore_type = 0
        self.datastore_idx = None
        self.datastore_name = None
        self.datastore_path = None
        self.datastore_schema = None
        self.default_data_type = 0

        self.dataTypeCombo.clear()
        self.dataTypeCombo.addItems(['Shape files folder','Personal geodatabase','PostGIS database'])

        # set up internal GUI signals
        QtCore.QObject.connect(self.closeButtonBox,QtCore.SIGNAL("rejected()"),self.close)
        QtCore.QObject.connect(self.closeButtonBox,QtCore.SIGNAL("accepted()"),self.updateSettings)
        self.dataTypeCombo.currentIndexChanged.connect(self.selectDatastoreType)
        self.dataSelectCombo.currentIndexChanged.connect(self.selectDatastore)
        self.schemaCombo.currentIndexChanged.connect(self.selectSchema)
        self.dataOpenButton.clicked.connect(self.openDatastore)
        self.dataNewButton.clicked.connect(self.newDatastore) 
Example #19
Source File: DepthmapAdvancedDialog.py    From qgisSpaceSyntaxToolkit with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self):
        QtGui.QDialog.__init__(self)
        # Set up the user interface from Designer.
        self.setupUi(self)

        # internal GUI signals
        self.axialDistanceCombo.currentIndexChanged.connect(self.setDistanceType)
        self.axialRadiusCombo.currentIndexChanged.connect(self.setRadiusType)
        self.axialStubsEdit.editingFinished.connect(self.checkRemoveStubs)

        # hide unused UI buttons
        self.axialDistanceLabel.hide()
        self.axialDistanceCombo.hide() 
Example #20
Source File: universal_tool_template_1000.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def setupUI(self, layout='grid'):
        #------------------------------
        # main_layout auto creation for holding all the UI elements
        #------------------------------
        main_layout = None
        if isinstance(self, QtWidgets.QMainWindow):
            main_widget = QtWidgets.QWidget()
            self.setCentralWidget(main_widget)        
            main_layout = self.quickLayout(layout, 'main_layout') # grid for auto fill window size
            main_widget.setLayout(main_layout)
        else:
            # main_layout for QDialog
            main_layout = self.quickLayout(layout, 'main_layout')
            self.setLayout(main_layout) 
Example #21
Source File: universal_tool_template_0904.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def setupUI(self, layout='grid'):
        #------------------------------
        # main_layout auto creation for holding all the UI elements
        #------------------------------
        main_layout = None
        if isinstance(self, QtWidgets.QMainWindow):
            main_widget = QtWidgets.QWidget()
            self.setCentralWidget(main_widget)        
            main_layout = self.quickLayout(layout, 'main_layout') # grid for auto fill window size
            main_widget.setLayout(main_layout)
        else:
            # main_layout for QDialog
            main_layout = self.quickLayout(layout, 'main_layout')
            self.setLayout(main_layout) 
Example #22
Source File: settingDialog.py    From LabelImgTool with MIT License 5 votes vote down vote up
def __init__(self, parent,config):
        QtGui.QDialog.__init__(self, parent)
        self.resize(320, 240)
        self.__class__.task_mode = config['task_mode']
        self.__class__.label_font_size = config['label_font_size']
        self.init_UI() 
Example #23
Source File: universal_tool_template_0903.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def setupWin(self):
        super(self.__class__,self).setupWin()
        self.setGeometry(500, 300, 250, 110) # self.resize(250,250)
        
        #------------------------------
        # template list: for frameless or always on top option
        #------------------------------
        # - template : keep ui always on top of all;
        # While in Maya, dont set Maya as its parent
        '''
        self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) 
        '''
        
        # - template: hide ui border frame; 
        # While in Maya, use QDialog instead, as QMainWindow will make it disappear
        '''
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
        '''
        
        # - template: best solution for Maya QDialog without parent, for always on-Top frameless ui
        '''
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint)
        '''
        
        # - template: for transparent and non-regular shape ui
        # note: use it if you set main ui to transparent, and want to use alpha png as irregular shape window
        # note: black color better than white for better look of semi trans edge, like pre-mutiply
        '''
        self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
        self.setStyleSheet("background-color: rgba(0, 0, 0,0);")
        ''' 
Example #24
Source File: universal_tool_template_0903.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def setupUI(self):
        #------------------------------
        # main_layout auto creation for holding all the UI elements
        #------------------------------
        main_layout = None
        if isinstance(self, QtWidgets.QMainWindow):
            main_widget = QtWidgets.QWidget()
            self.setCentralWidget(main_widget)        
            main_layout = self.quickLayout('vbox', 'main_layout') # grid for auto fill window size
            main_widget.setLayout(main_layout)
        else:
            # main_layout for QDialog
            main_layout = self.quickLayout('vbox', 'main_layout')
            self.setLayout(main_layout) 
Example #25
Source File: UITranslator_v1.0.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def __init__(self, parent=None, mode=0):
        QtGui.QMainWindow.__init__(self, parent)
        #QtGui.QDialog.__init__(self, parent)
        
        self.version="1.0"
        self.uiList={} # for ui obj storage
        self.memoData = {} # key based variable data storage
        
        self.fileType='.UITranslator_EXT'
        # mode: example for receive extra user input as parameter
        self.mode = 0
        if mode in [0,1]:
            self.mode = mode # mode validator
        
        self.location = ""
        if getattr(sys, 'frozen', False):
            # frozen - cx_freeze
            self.location = sys.executable
        else:
            # unfrozen
            self.location = os.path.realpath(__file__) # location: ref: sys.modules[__name__].__file__
            
        self.setupStyle()
        self.setupMenu() # only if you use QMainWindows Class
        self.setupWin()
        self.setupUI()
        self.Establish_Connections()
        self.loadData()
        self.loadLang() 
Example #26
Source File: UITranslator.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def setupUI(self):
        #------------------------------
        # main_layout auto creation for holding all the UI elements
        #------------------------------
        main_layout = None
        if isinstance(self, QtWidgets.QMainWindow):
            main_widget = QtWidgets.QWidget()
            self.setCentralWidget(main_widget)        
            main_layout = self.quickLayout('vbox', 'main_layout') # grid for auto fill window size
            main_widget.setLayout(main_layout)
        else:
            # main_layout for QDialog
            main_layout = self.quickLayout('vbox', 'main_layout')
            self.setLayout(main_layout)

        #------------------------------
        # user ui creation part
        #------------------------------
        # + template: qui version since universal tool template v7
        #   - no extra variable name, all text based creation and reference
        
        self.qui('dict_table | source_txtEdit | result_txtEdit','info_split;v')
        self.qui('filePath_input | fileLoad_btn;Load | fileLang_choice | fileExport_btn;Export', 'fileBtn_layout;hbox')
        
        self.qui('info_split | process_btn;Process and Update Memory From UI | fileBtn_layout', 'main_layout')
        self.uiList["source_txtEdit"].setWrap(0)
        self.uiList["result_txtEdit"].setWrap(0)
        
        #------------- end ui creation --------------------
        for name,each in self.uiList.items():
            if isinstance(each, QtWidgets.QLayout) and name!='main_layout' and not name.endswith('_grp_layout'):
                each.setContentsMargins(0,0,0,0) # clear extra margin some nested layout
        #self.quickInfo('Ready') 
Example #27
Source File: GearBox_template_1010.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def setupUI(self, layout='grid'):
        #------------------------------
        # main_layout auto creation for holding all the UI elements
        #------------------------------
        main_layout = None
        if isinstance(self, QtWidgets.QMainWindow):
            main_widget = QtWidgets.QWidget()
            self.setCentralWidget(main_widget)        
            main_layout = self.quickLayout(layout, 'main_layout') # grid for auto fill window size
            main_widget.setLayout(main_layout)
        else:
            # main_layout for QDialog
            main_layout = self.quickLayout(layout, 'main_layout')
            self.setLayout(main_layout) 
Example #28
Source File: modal_dialogs.py    From tutorials with MIT License 5 votes vote down vote up
def _get_dialog(self):
		""" Private helper method to return a common test dialog """
		dialog = QtGui.QDialog(self)
		dialog.resize(100,100)	
		accept = QtGui.QPushButton("Accept", dialog)
		accept.clicked.connect(dialog.accept)
		return dialog 
Example #29
Source File: messageui.py    From procexp with GNU General Public License v3.0 5 votes vote down vote up
def doMessageWindow(msg):
  """Make a message window"""
  _loadMsgSettings()
  if g_settings.has_key(msg):
    return
  global dialog
  dialog = QtGui.QDialog()
  msgDialog = uic.loadUi(os.path.join(os.path.dirname(__file__), "./ui/message.ui"), baseinstance=dialog)
  msgDialog.messageLabel.setText(msg)
  dialog.exec_()
  if msgDialog.showAgainCheckBox.isChecked():
    g_settings[msg] = True
    _saveMsgSettings() 
Example #30
Source File: table.py    From Writer with MIT License 5 votes vote down vote up
def __init__(self,parent = None):
        QtGui.QDialog.__init__(self, parent)

        self.parent = parent
         
        self.initUI()