Пример #1
0
 def closeEvent(self, event=None):
     if self.Processing is not None:
         if event is not None:
             r = QMessageBox.question(
                 self,
                 "Making sure",
                 "Are you sure you want to exit, during an active" +
                 " process ?",
                 QMessageBox.Yes | QMessageBox.No)
         else:
             r = QMessageBox.question(
                 self,
                 "Making sure",
                 "Are you sure, you to cancel ?",
                 QMessageBox.Yes | QMessageBox.No)
         if r == QMessageBox.Yes:
             self.P.stop()
             self.cleanup()
             if event is not None:
                 self.in_loop()
                 event.accept()
             else:
                 self.in_loop()
         else:
             if event is not None:
                 event.ignore()
     else:
         if self.CP is not None:
             try:
                 if path.isfile(self.CP + '-journal'):
                     remove(self.CP + '-journal')
             except:
                 pass
         if event is not None:
             event.accept()
Пример #2
0
 def exitFile(self):     
     if self.i==0:         
         userInfo =QMessageBox.question(self,self.language.Exit,self.language.RUSURE,QMessageBox.Yes | QMessageBox.No)
         if userInfo == QMessageBox.Yes: 
             self.close()
         else:
             pass
     else:
         userInfo =QMessageBox.question(self,self.language.Exit,self.language.OTab,QMessageBox.Yes | QMessageBox.No)
         if userInfo == QMessageBox.Yes: 
             self.close()
         else:
             pass
Пример #3
0
    def backup(self):
        import shutil

        dt = datetime.now()
        dst = "norm-%s.db" % (dt.strftime('%Y%m%dialog%H%M%S'))
        if not os.path.exists("backup"):
            os.makedirs("backup")

        shutil.copy(settings.DATABASE_FILENAME, os.path.join("backup", dst))
        QMessageBox.question(
            Window, u"Резервное копирование",
            u"Резервное копирование базы данных завершено.\n %s" %
            (str(os.path.join("backup", dst))))
Пример #4
0
 def on_rpmPrepButton_clicked(self):
     projectName = self.getCurrentProject()
     if projectName is None:
         return
     alreadyInstalled = list()
     for package in self.selectedPackages():
         if self.manager.isInstalledInChRoot(self.__project, package):
             alreadyInstalled.append(package)
     if len(alreadyInstalled) > 0:
         questionString = u"The packages <b>%s" % unicode(
             alreadyInstalled[0])
         for package in alreadyInstalled[1:]:
             questionString += u", %s" % unicode(package)
         questionString += u"</b> are already present in the project file system, "
         questionString += u"do you want to overwrite them ?"
         result = QMessageBox.question(self.mainWindow,
                                       u"Overwrite ?",
                                       questionString,
                                       buttons=QMessageBox.Yes
                                       | QMessageBox.Cancel,
                                       defaultButton=QMessageBox.Yes)
         if result != QMessageBox.Yes:
             return
     self.__mapOnSelectedPackages(
         firstArgLast(self.manager.buildPrep), None,
         u"Importing %(arg)s source in file system " +
         "and executing %%prep", self.__handleRpmOperationResult,
         projectName)
Пример #5
0
 def _actNewLogbookTriggered(self):
     'New Logbook Action Event Handler'
     if self._logbook is not None:
         dir = os.path.dirname(self._logbookPath)
     else:
         dir = os.path.expanduser('~')
         
     fn = QFileDialog.getSaveFileName(self, 
         caption=self.tr('Save new Logbook as...'), dir=dir,
         filter='Logbook Files (*.lbk);;All Files (*.*)')[0]
     if fn == '':
         return
     if os.path.exists(fn):
         if QMessageBox.question(self, self.tr('Create new Logbook?'), 
                 self.tr('Logbook "%s" already exists. Would you like to overwrite it?') % os.path.basename(fn),
                 QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes) != QMessageBox.Yes:
             return
         
         # Try and remove the old Logbook file
         try:
             os.remove(fn)
         except:
             QMessageBox.error(self, self.tr('Cannot remove Logbook'),
                 self.tr('Unable to remove Logbook file "%s". Please delete this file manually.') % os.path.basename(fn),
                 QMessageBox.Ok, QMessageBox.Ok)
             return
     
     # Create a new Logbook File
     Logbook.Create(fn)
     self._openLogbook(fn)
Пример #6
0
 def popup_edit_users(self, item):
     """
     Pops up the menu to be edited
     :param item: item clicked
     :return:none
     """
     table = self.ui.adminpopup_assign_members_table
     model_index = table.indexFromItem(item)
     row = model_index.row()
     item = table.item(row, 0)
     members = item.text()
     if item:
         ask = QMessageBox.question(
             self, 'Confirm',
             'The user will be removed from the group, are you sure?',
             QMessageBox.Yes | QMessageBox.No)
         if ask == QMessageBox.Yes:
             status = self.login.access.delete_table_user(username=members)
             if status[0]:
                 QMessageBox.information(self, 'Success', status[1],
                                         QMessageBox.Ok)
                 table.removeRow(row)
             else:
                 QMessageBox.warning(self, 'Fail', status[1],
                                     QMessageBox.Ok)
Пример #7
0
 def closeEvent(self, event):
     ret = QMessageBox.question(self, u"警告", u"确定要关闭吗",
                                QMessageBox.Yes | QMessageBox.No)
     if ret == QMessageBox.No:
         event.ignore()
         return
     self.tcp_link.close()
Пример #8
0
    def add_person(self):
        self.writting = True

        if (self.name_dir.strip() == "") :
            print ("No name inserted")
            return

        dir = os.path.join(CURRENT_PATH,"../files/dataset", self.name_dir.strip().lower())  #se crea el directorio en minusculas y sin espacios
        print (dir)

        if os.path.isdir(dir):
            reply = QMessageBox.question(self.focusWidget(), 'The directory already exists',
                                         ' Do you want to overwrite it?', QMessageBox.Yes, QMessageBox.No)

            if reply == QtGui.QMessageBox.No:
                self.ui.name_lineEdit.clear()
                self.writting = False
                return

            else:
                self.time_Lapse(dir)

        else:
            os.mkdir(dir)
            self.time_Lapse(dir)

        self.update_model()



        self.ui.name_lineEdit.clear()
        self.writting = False
Пример #9
0
 def msgApp(self, title, msg):
     uinfo = QMessageBox.question(self, title,
                                  msg, QMessageBox.Yes | QMessageBox.No)
     if uinfo == QMessageBox.Yes:
         return 'y'
     if uinfo == QMessageBox.No:
         return 'n'
Пример #10
0
 def delete(self):  # No need to restore focus widget
     row = self.listWidget.currentRow()
     item = self.listWidget.item(row)
     if item is None:
         return
     gid = item.data(Qt.UserRole)
     for button in self.buttons:
         button.setEnabled(False)
     deleteItem = False
     if (not self.state.model.isLinkedGroup(gid)
             or not self.state.model.groupMemberCount(gid)):
         with Lib.Qt.DisableUI(self, forModalDialog=True):
             reply = QMessageBox.question(
                 self,
                 "Delete Group — {}".format(QApplication.applicationName()),
                 "<p>Delete Group “{}”?</p>".format(item.text()),
                 QMessageBox.Yes | QMessageBox.No)
         if reply == QMessageBox.Yes:
             self.state.model.deleteGroup(gid)
             deleteItem = True
     else:
         with Lib.Qt.DisableUI(self, forModalDialog=True):
             form = Forms.DeleteOrUnlink.Form("Delete", gid, self.state,
                                              self)
             deleteItem = form.exec_()
     if deleteItem:
         item = self.listWidget.takeItem(row)
         del item
     self.updateUi()
Пример #11
0
    def confirmToRemove(self, txt):
        question = QMessageBox.question(self, "Remove",
                                        "Remove '{0}'?".format(txt),
                                        QMessageBox.Yes | QMessageBox.Default,
                                        QMessageBox.No)

        return question == QMessageBox.Yes
Пример #12
0
    def save_crops(self):
        """Saves cropped specimen images
        """
        debug_print('MainWindow.save_crops')
        res = QMessageBox.Yes
        existing_crops = self.document.crops_dir.is_dir()

        if existing_crops:
            msg = 'Overwrite the existing cropped specimen images?'
            res = QMessageBox.question(self, 'Write cropped specimen images?',
                                       msg, QMessageBox.No, QMessageBox.Yes)

        if QMessageBox.Yes == res:

            def save_crops(progress):
                progress('Loading full-resolution scanned image')
                self.document.scanned.array

                progress('Saving crops')
                self.document.save_crops(progress)

            def completed(operation):
                QMessageBox.information(self, "Crops saved", msg)

            self.model.to_document(self.document)
            msg = "{0} crops saved in {1}"
            msg = msg.format(self.document.n_items, self.document.crops_dir)
            self.run_in_worker(save_crops, 'Save crops', completed)
Пример #13
0
    def okToContinue(self):
        """
        Checks if it is ok to close the application.
        The user will be prompted to save files.

        @return: True, if it is ok to continue (e.g. close the app); False, otherwise
        @rtype: bool

        @todo: Make a smart save dialog to allow the user to save only certain files.
        """
        dirtyFilenames = []
        for filename, networkController in self.ModelControllers.items():
            if networkController.Dirty:
                dirtyFilenames.append(
                    networkController.filename)   # we don't use the filename key because it might be outdated
        if len(dirtyFilenames) == 0:    #nothing to save
            return True

        reply = QMessageBox.question(self,
                                     "BioParkin - Unsaved Changes",
                                     "Unsaved changes in these files:\n\n%s\n\nDo you want to save them?" % "\n".join(
                                         dirtyFilenames),
                                     buttons=QMessageBox.SaveAll | QMessageBox.Discard | QMessageBox.Cancel)
        if reply == QMessageBox.Cancel:
            return False
        elif reply == QMessageBox.SaveAll:
            for networkController in self.ModelControllers:
                if networkController.Dirty:
                    networkController.save()
        return True
Пример #14
0
 def closeEvent(self, event):
     message = unicode("Deseja mesmo sair?".decode('utf-8'))
     reply = QMessageBox.question(self, 'Seareiros', message, QMessageBox.Yes, QMessageBox.No)
     if reply == QMessageBox.Yes:
         event.accept()
     else:
         event.ignore()
Пример #15
0
    def doActionSageServer(self):
        server_list_dialog = ServerListDlg(self)

        #Get a reference to the WorksheetController associated to this window.
        wsc = self.webViewController().worksheet_controller

        #Select the server associated to this window, if there is one.
        if wsc and wsc.server_configuration:
            server_list_dialog.selectServer(wsc.server_configuration)

        #Show the dialog.
        server_list_dialog.exec_()

        #It's possible that the user will delete all of the servers. It's not clear how to cleanly handle this case.
        #We choose to give the user a choice to fix the situation.
        while not ServerConfigurations.server_list:
            #No servers?
            message_text = "Guru needs a Sage server configured in order to evaluate cells. " \
                            "Add a Sage server configuration in the server configuration dialog?"
            response = QMessageBox.question(self, "Sage Not Configured", message_text, QMessageBox.Yes, QMessageBox.No)
            if response == QMessageBox.No:
                return
            server_list_dialog.exec_()

        #Execution only reaches this point if there exists a server.
        server_name = server_list_dialog.ServerListView.currentItem().text()
        if wsc:
            new_config = ServerConfigurations.getServerByName(server_name)
            try:
                wsc.useServerConfiguration(new_config)
            except Exception as e:
                QMessageBox.critical(self, "Error Switching Servers", "Could not switch servers:\n%s" % e.message)
Пример #16
0
    def okToContinue(self):
        """
        Checks if it is ok to close the application.
        The user will be prompted to save files.

        @return: True, if it is ok to continue (e.g. close the app); False, otherwise
        @rtype: bool

        @todo: Make a smart save dialog to allow the user to save only certain files.
        """
        dirtyFilenames = []
        for filename, networkController in self.ModelControllers.items():
            if networkController.Dirty:
                dirtyFilenames.append(
                    networkController.filename
                )  # we don't use the filename key because it might be outdated
        if len(dirtyFilenames) == 0:  # nothing to save
            return True

        reply = QMessageBox.question(
            self,
            "BioParkin - Unsaved Changes",
            "Unsaved changes in these files:\n\n%s\n\nDo you want to save them?" % "\n".join(dirtyFilenames),
            buttons=QMessageBox.SaveAll | QMessageBox.Discard | QMessageBox.Cancel,
        )
        if reply == QMessageBox.Cancel:
            return False
        elif reply == QMessageBox.SaveAll:
            for networkController in self.ModelControllers:
                if networkController.Dirty:
                    networkController.save()
        return True
Пример #17
0
 def popup_edit_roles(self, item):
     """
     Pops up the menu to be edited
     :param item: item clicked
     :return:none
     """
     table = self.ui.adminpopup_assign_roles_table
     model_index = table.indexFromItem(item)
     row = model_index.row()
     item = table.item(row, 0)
     role = item.text()
     group = self.ui.adminpopup_assign_groupname_combobox.currentText()
     if item:
         ask = QMessageBox.question(self, 'Confirm',
                                    'Role will be removed from the group',
                                    QMessageBox.Yes | QMessageBox.No)
         if ask == QMessageBox.Yes:
             status = self.login.access.delete_role(group_name=group,
                                                    role=role)
             if status[0]:
                 QMessageBox.information(self, 'Success', status[1],
                                         QMessageBox.Ok)
                 table.removeRow(row)
             else:
                 QMessageBox.warning(self, 'Fail', status[1],
                                     QMessageBox.Ok)
Пример #18
0
    def on_addAndCommitButton_clicked(self):
        project = self.getCurrentProject()
        package = self.currentPackage()
        if project is None or package is None:
            return

        conflict = self.manager.testConflict(project, package)

        if conflict:
            question = u"A file in package <i>%s</i> has a conflict.<br />"
            question += u"It is recommended that you resolve this conflict before committing.<br />"
            question += u"-> modify conflicting file and run "
            question += u"<i>osc resolved FILE</i> in package directory.<br />"
            question += u"<br />Do you want to continue anyway?"
            result = QMessageBox.question(self.mainWindow,
                                          u"Conflict detected",
                                          question % package,
                                          buttons=QMessageBox.Yes
                                          | QMessageBox.Cancel,
                                          defaultButton=QMessageBox.Cancel)
            if result != QMessageBox.Yes:
                return

        self.__commitDialog = self.gui.loadWindow(u"commitMessageDialog.ui")
        self.__commitDialog.accepted.connect(self.__doCommit)
        self.__commitDialog.show()
Пример #19
0
 def clearDock(self):
     ''' clear session (dock widget elements)
     - remove showSessionMeta
     - remove showRunMeta
     - kill kinectRecorder
     - remove session
     
     if changes are not saved, ask
     '''
     if self.showSessionMeta is not None:
         reply = QMessageBox.question(self, 'QMessageBox.question()',
                                      'Do you want to first save the current session?',
                                      QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel)
         if reply == QMessageBox.Yes:
             self.save()
         elif reply == QMessageBox.Cancel:
             return 
         
         self.session = None
         self.dockLayout.removeWidget(self.showSessionMeta)
         self.dockLayout.removeWidget(self.showRunMeta)
         self.showSessionMeta.deleteLater()
         self.showRunMeta.deleteLater()
         self.showSessionMeta = None
         self.showRunMeta = None
         self.kinectRecorder.killRecorder()
Пример #20
0
    def new_wallet_ui(self):
        result = QMessageBox.question(self.ui, "Open/Create New Wallet", \
                                      "<b>This will close current wallet to create/restore a new wallet!</b><br><br>Are you sure to continue?", \
                                       QMessageBox.Yes | QMessageBox.No, defaultButton=QMessageBox.No)
        if result == QMessageBox.No:
            return

        wallet_password, result = self._custom_input_dialog(self.ui, \
                        "Wallet Password", "Please enter wallet password:"******"Incorrect Wallet Password",
                                "Wallet password is not correct!")
            return

        ret = self.ui.wallet_rpc_manager.rpc_request.close_wallet()
        if ret['status'] == "ERROR":
            error_message = ret['message']
            QMessageBox.critical(self.ui, \
                    'Error Closing Current Wallet',\
                    "Error: %s" % error_message)
            return

        self.current_block_height = 0
        self.ui.show_new_wallet_ui()
Пример #21
0
 def save_user(self):
     """
     saves the user details of the selected user
     """
     name = self.ui.adminpopup_createuser_name_linedit.text()
     username = self.ui.adminpopup_createuser_username_linedit.text()
     password = self.ui.adminpopup_createuser_password_linedit.text()
     pattern = re.compile("xxxxxxxxxx")
     searching = pattern.search(password)
     if not searching:
         ask = QMessageBox.question(
             self, 'Confirm',
             'The password has been changed, do you want to save the new password?',
             QMessageBox.Yes | QMessageBox.No)
         if ask == QMessageBox.Yes:
             pass
         else:
             password = None
     status = self.login.access.save_user_details(name=name,
                                                  username=username,
                                                  password=password)
     if status[0]:
         QMessageBox.information(self, 'Success', status[1], QMessageBox.Ok)
         self.fill_users()
     else:
         QMessageBox.warning(self, 'Fail', status[1], QMessageBox.Ok)
Пример #22
0
    def close_document(self):
        """Closes the document and returns True if not modified or if modified
        and user does not cancel. Does not close the document and returns False
        if modified and users cancels.
        """
        debug_print('MainWindow.close_document')
        if self.model.modified:
            # Ask the user if they work like to save before closing
            res = QMessageBox.question(
                self, 'Save document?', 'Save the document before closing?',
                (QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel),
                QMessageBox.Yes)

            if QMessageBox.Yes == res:
                self.save_document()

            # Answering Yes or No means the document will be closed
            close = QMessageBox.Cancel != res
        else:
            # The document is not modified so it is OK to close it
            close = True

        if close:
            self.empty_document()

        return close
Пример #23
0
 def exit(self):
     button = QMessageBox.question(
         self, self.tr('Notepad - Quit'),
         self.tr('Do you really want to quit?'),
         QMessageBox.Yes | QMessageBox.No)
     if button == QMessageBox.Yes:
         self.window().close()
Пример #24
0
    def Activated(self):

        doc = FreeCAD.ActiveDocument
        (text, ok) = QInputDialog.getText(None, Title_MessageBoxes,
                                          "Name for optical system?",
                                          QLineEdit.Normal)
        osobs = None
        if text and ok:
            osobs = OpticalSystemObserver(doc, text)

        if existsStandardMaterials(doc):
            result = QMessageBox.question(
                None, Title_MessageBoxes,
                "No Standard Materials Catalogue defined. Create one?",
                QMessageBox.Yes | QMessageBox.No)
            if result == QMessageBox.Yes:
                stdmatcatalogue = MaterialCatalogueObject(
                    doc, Group_StandardMaterials_Label)
                stdmatcatalogue.addMaterial("ConstantIndexGlass",
                                            "PMMA",
                                            index=1.5)
                stdmatcatalogue.addMaterial("ConstantIndexGlass", "Vacuum")
                stdmatcatalogue.addMaterial("ModelGlass",
                                            "mydefaultmodelglass")

        if osobs != None:
            osobs.initFromGivenOpticalSystem(osobs.initDemoSystem())
Пример #25
0
 def deleteXRef(self):
     widget = QApplication.focusWidget()
     self.state.maybeSave()
     item = self.state.entryPanel.xrefList.currentItem()
     if item is not None:
         xref = Xix.Util.xref_for_data(item.data(Qt.UserRole))
         from_term = self.state.model.term(xref.from_eid)
         kind = "see" if xref.kind is XrefKind.SEE else "see also"
         if xref.kind in {XrefKind.SEE, XrefKind.SEE_ALSO}:
             term = self.state.model.term(xref.to_eid)
         elif xref.kind in {
                 XrefKind.SEE_GENERIC, XrefKind.SEE_ALSO_GENERIC
         }:
             term = xref.term
             kind += " (generic)"
         with Lib.Qt.DisableUI(*self.window.widgets(), forModalDialog=True):
             reply = QMessageBox.question(
                 self.window, "Delete Cross-reference — {}".format(
                     QApplication.applicationName()),
                 "<p>Delete cross-reference from<br>“{}” to {} “{}”?".
                 format(from_term, kind, term),
                 QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes)
         if reply == QMessageBox.Yes:
             if xref.kind in {XrefKind.SEE, XrefKind.SEE_ALSO}:
                 self.state.model.deleteXRef(xref.from_eid, xref.to_eid,
                                             xref.kind)
             elif xref.kind in {
                     XrefKind.SEE_GENERIC, XrefKind.SEE_ALSO_GENERIC
             }:
                 self.state.model.deleteGenericXRef(xref.from_eid,
                                                    xref.term, xref.kind)
     Lib.restoreFocus(widget)
Пример #26
0
    def updateQuestion(self, section=(), subsection=(), function=()):
        """
        Updates a section item
        """
        
        if section != ():
           category = 'section'
           oldWho = section[1]
           newWho = section[0]

        if subsection != ():
           category = 'subsection'
           oldWho = subsection[1]
           newWho = subsection[0]
        
        if function != ():
           category = 'function'
           oldWho = function[1]
           newWho = function[0]
        
        return QMessageBox.question(self,
                                    self.tr('Update'),
                                    self.tr('Do you want to update item "{}" to "{}" in {}?'.format(oldWho[0],newWho,category)),
                                    QMessageBox.Yes | QMessageBox.No,
                                    QMessageBox.No)
Пример #27
0
    def get_new_address(self):
        result = QMessageBox.question(self.add_pool_dialog, "Get New Wallet Address?", \
             "This will open Cryptonote generator in browser.<br><br>\
             Are you sure to proceed?"                                      , \
             QMessageBox.Yes | QMessageBox.No, defaultButton=QMessageBox.Yes)

        if result == QMessageBox.No: return
        self.open_link("https://wallet.evonote.com")
Пример #28
0
 def updateQuestion(self, category, xxx_todo_changeme):
     """Updates a section item."""
     (old_who, new_who) = xxx_todo_changeme
     return QMessageBox.question(
         self, self.tr('Update'),
         self.tr("Do you want to update item '{}' to '{}' in {}?".format(
             old_who, new_who, category)), QMessageBox.Yes | QMessageBox.No,
         QMessageBox.No)
Пример #29
0
    def search_mayaenv_path(self):
        usd = cmds.internalVar(usd=True)
        ud = '/'.join(usd.split('/')[0:-2])
        p = os.path.join(ud, 'Maya.env')

        if not os.path.exists(p):
            # searching path for environments other than English UI
            ud = '/'.join(usd.split('/')[0:-3])
            p = os.path.join(ud, 'Maya.env')
            if not os.path.exists(p):
                QMessageBox.question(
                    self, "Error",
                    "Maya.env is not detected (at: {0}), check your installation or call your system administrator."
                    .format(p), QMessageBox.Ok | QMessageBox.Default)
                raise "Maya.env is not detected"

        return p
Пример #30
0
    def get_new_address(self):
        result = QMessageBox.question(self.add_pool_dialog, "Get New Wallet Address?", \
             "This will open HongbaoBlockchain/Monero/Aeon wallet generator in browser.<br><br>\
             Are you sure to proceed?"                                      , \
             QMessageBox.Yes | QMessageBox.No, defaultButton=QMessageBox.Yes)

        if result == QMessageBox.No: return
        self.open_link("https://wallet.hongbao.com")
Пример #31
0
 def handleExitAction(self, show_confirmation=False):
     reply = QMessageBox.No
     if show_confirmation:
         reply=QMessageBox.question(self,'Exit %s?' % APP_NAME,
                 "Are you sure to exit %s?" % APP_NAME, QMessageBox.Yes,QMessageBox.No)
     if not show_confirmation or reply==QMessageBox.Yes:
         self.trayIcon.hide()
         QTimer.singleShot(250, self.app.quit)
Пример #32
0
    def confirm_deletion(self, employer):
        msg = 'Are you sure you want to delete "%s"? This will delete all ' \
              'employees associated with it.' % employer.text(1)

        return QMessageBox.question(self,
                                    self.tr("Confirm Deletion"),
                                    msg,
                                    (QMessageBox.Yes | QMessageBox.No)) == QMessageBox.Yes
Пример #33
0
    def removeQuestion(self, category='', who=[]):
        """Removes a section item."""

        return QMessageBox.question(
            self, self.tr('Remove'),
            self.tr("Do you want to remove item(s) {} from {}?".format(
                str(who)[1:-1], category)), QMessageBox.Yes | QMessageBox.No,
            QMessageBox.No)
Пример #34
0
 def msgApp(self, title, message):
     """ Fuction to show dialog box with message """
     userInfo = QMessageBox.question(self, title, message,
                                     QMessageBox.Yes | QMessageBox.No)
     if userInfo == QMessageBox.Yes:
         return "Y"
     if userInfo == QMessageBox.No:
         return "N"
     self.close()
Пример #35
0
 def removeQuestion(self, category='', who=''):
     """
     Removes a section item
     """
     return QMessageBox.question(self,
                                 self.tr('Remove'),
                                 self.tr('Do you want to remove item {} from {}?'.format(who, category)),
                                 QMessageBox.Yes | QMessageBox.No,
                                 QMessageBox.No)
Пример #36
0
	def delete_project_clciked(self):
		ixs = self.projects_table.selectionModel().selectedRows()
		ix_num = len(ixs)
		title = "Delete project%s" % ("s" if ix_num > 1 else "",)
		message = "Are you sure? (%d project%s)" % (ix_num, "s" if ix_num > 1 else "")
		ret = QMessageBox.question(self, title, message, 
							QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes)
		if ret == QMessageBox.Yes:
			self.project_service.delete_projects(ixs)
Пример #37
0
 def on_btnCancel_clicked(self):
     if not self._addForm.is_dirty():
         self.close()
     else:
         message = unicode("Descartar dados não salvos e sair?".decode('utf-8'))
         reply = QMessageBox.question(self, 'Seareiros - Cadastro de Associados',
                                      message, QMessageBox.Yes, QMessageBox.No)
         if reply == QMessageBox.Yes:
             self.close()
Пример #38
0
    def confirm_deletion(self, employee):
        name = "%s %s" % (employee.text(1), employee.text(2))

        msg = 'Are you sure you want to delete "%s"?' % name

        return QMessageBox.question(self,
                                    self.tr("Confirm Deletion"),
                                    msg,
                                    (QMessageBox.Yes | QMessageBox.No)) == QMessageBox.Yes
Пример #39
0
 def __CheckForInsufficientSpaceOnArchive(self):
     if Progress.statuses['BatchStatus'] == 'Insufficient Drive Space': #other possible value is 'Completed'    
         boxChoice = QMessageBox.question(self, 'Message',
                 "There is insufficient room on your archive drive. Would you "
                 "like to make room and try again? Selecting 'No' will skip archiving. "
                 , QMessageBox.Yes | 
                 QMessageBox.No, QMessageBox.No)
         if boxChoice == QMessageBox.Yes:
             Progress.ArchiveSourceVideo(self.qleArchiveDir.text(), self.qleSourceDir.text(), self.qleTargetDir.text())
Пример #40
0
 def _btnRemoveComputerClicked(self):
     'Remove a Dive Computer'
     idx = self._cbxComputer.currentIndex()
     dc = self._cbxComputer.itemData(idx, Qt.UserRole+0)
     if QMessageBox.question(self, self.tr('Delete Dive Computer?'), 
                 self.tr('Are you sure you want to delete "%s"?') % dc.name,
                 QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes) == QMessageBox.Yes:
         self._logbook.session.delete(dc)
         self._logbook.session.commit()
         self._cbxComputer.model().reload()
Пример #41
0
 def quit_app(self):
     """ Function to confirm a message from the user
     """
     userInfo = QMessageBox.question(self, 'Bestätigung',
     'Das Programm wird geschlossen. Willst Du das wirklich?',
     QMessageBox.Yes | QMessageBox.No)
     if userInfo == QMessageBox.Yes:
         self.app.quit()
     if userInfo == QMessageBox.No:
         pass
Пример #42
0
 def proceed(self):
     if self.document.items:
         msg = ('Segmenting will cause all boxes and metadata to be '
                'replaced.\n\nContinue and replace all existing '
                'boxes and metadata')
         res = QMessageBox.question(self.parent, 'Replace boxes?', msg,
                                    QMessageBox.No, QMessageBox.Yes)
         return QMessageBox.Yes == res
     else:
         return True
 def quitApp(self):
    """ Function to confirm a message from the user
    """
    userInfo = QMessageBox.question(self, 'Confirmation',
    "This will quit the application. Do you want to Continue?",
    QMessageBox.Yes | QMessageBox.No)
    if userInfo == QMessageBox.Yes:
        myApp.quit()
    if userInfo == QMessageBox.No:
       pass
Пример #44
0
 def quit_application(self):
     # ================================
     # Function to quit the application
     # ================================
     userinfo = QMessageBox.question(self, "Confirmation", "This will quit, Do you want to continue?",
                                     QMessageBox.Yes | QMessageBox.No)
     if userinfo == QMessageBox.Yes:
         templateApp.quit()
     if userinfo == QMessageBox.No:
         pass
 def quitApp(self):
    """ Function to confirm a message from the user
    """
    userInfo = QMessageBox.question(self, 'Confirmation',
    "This will quit the application. Do you want to Continue?",
    QMessageBox.Yes | QMessageBox.No)
    if userInfo == QMessageBox.Yes:
        myApp.quit()
    if userInfo == QMessageBox.No:
       pass
Пример #46
0
 def save(self):
     """
     :return:saves the details of the user
     """
     name = self.ui.adminpopup_hotelname_linedit.text()
     street = self.ui.adminpopup_street_linedit.text()
     city = self.ui.adminpopup_city_linedit.text()
     pin = self.ui.adminpopup_pin_linedit.text()
     longitude = self.ui.adminpopup_longitude_linedit.text()
     latitude = self.ui.adminpopup_latitude_linedit.text()
     apikey = self.ui.adminpopup_apikey_linedit.text()
     tax = self.ui.adminpopup_tax_linedit.text()
     profileid = self.ui.adminpopup_profileid_linedit.text()
     password = self.ui.adminpopup_password_linedit.text()
     fssai = self.ui.adminpopup_fssai_linedit.text()
     tin = self.ui.adminpopup_tin_linedit.text()
     pattern = re.compile("xxxxxxxxxx")
     searching = pattern.search(password)
     if not searching:
         ask = QMessageBox.question(
             self, 'Confirm',
             'The password has been changed, do you want to save the new password?',
             QMessageBox.Yes | QMessageBox.No)
         if ask == QMessageBox.Yes:
             pass
         else:
             password = None
     details = {
         'name': name,
         'street': street,
         'city': city,
         'pin': pin,
         'longitude': longitude,
         'latitude': latitude,
         'apikey': apikey,
         'tax': tax,
         'fssai': fssai,
         'tin': tin,
         'profileid': profileid,
         'password': password
     }
     for i, j in details.iteritems():
         if not j:
             QMessageBox.critical(
                 self, 'Error',
                 'The field %s is not filled properly' % i.title(),
                 QMessageBox.Ok)
             return False
     status = self.login.access.save_details(
         details
     )  ###also check if the password is changed and prompt a message box
     if status:
         QMessageBox.information(self, "Success!!!",
                                 "The details have been saved",
                                 QMessageBox.Ok)
Пример #47
0
 def okToContinue(self):
     if self.dirty:
         reply = QMessageBox.question(
             self, "Data Loader - Unsaved Changes", "Save unsaved changes?",
             QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel)
         if reply == QMessageBox.Cancel:
             return False
         elif reply == QMessageBox.Yes:
             self.clearDirty()
             return self.fileSave()
     return True
Пример #48
0
    def quitter(self):
        """Function to confirm before quittin"""

        userInfo=QMessageBox.question(self, 'Confirmation', "This will quit the application.  Continue?", QMessageBox.Yes | QMessageBox.No)

        if userInfo==QMessageBox.Yes:
            print "answer yes"
            myApp.quit()
        else:
            print "answer no"
            pass
Пример #49
0
    def yesNoBox(title, text):
        """
        Spawns a MessageBox that asks the user a Yes-No question.

        :return: True if the user has clicked on Yes, else False
        """

        answer = QMessageBox.question(Globals.ui.tabWidgetMain, title, text,
                                      QMessageBox.Yes | QMessageBox.No)

        return answer == QMessageBox.Yes
Пример #50
0
 def closeEvent(self, event):
     if not self._editForm.is_dirty():
         super(EditDock, self).closeEvent(event)
         event.accept()
     else:
         message = unicode("Descartar dados não salvos e sair?".decode('utf-8'))
         reply = QMessageBox.question(self, 'Seareiros', message, QMessageBox.Yes, QMessageBox.No)
         if reply == QMessageBox.Yes:
             super(EditDock, self).closeEvent(event)
             event.accept()
         else:
             event.ignore()
Пример #51
0
 def closeEvent(self, event):
     if not self._addForm.is_dirty():
         super(OrderDock, self).closeEvent(event)
         event.accept()
     else:
         message = unicode("A venda ainda não foi registrada, sair mesmo assim?".decode('utf-8'))
         reply = QMessageBox.question(self, 'Seareiros', message, QMessageBox.Yes, QMessageBox.No)
         if reply == QMessageBox.Yes:
             super(OrderDock, self).closeEvent(event)
             event.accept()
         else:
             event.ignore()
Пример #52
0
 def okToContinue(self):
     if self.dirty:
         reply = QMessageBox.question(self,
                 "Data Loader - Unsaved Changes",
                 "Save unsaved changes?",
                 QMessageBox.Yes|QMessageBox.No|QMessageBox.Cancel)
         if reply == QMessageBox.Cancel:
             return False
         elif reply == QMessageBox.Yes:
             self.clearDirty()
             return self.fileSave()
     return True
Пример #53
0
 def supprimer(self):
     u"""Supprime un item de la liste, après confirmation"""
     index = self._ui.tv.currentIndex()
     if not self.preSupprVerification(index):
         return
     row = index.row()
     if -1 == row:
         QMessageBox.information(self, self.titreErrSuppression(), self.msgErrSuppression())
     else:
         supprimer = QMessageBox.question(
             self, "Confirmer la suppression", self.msgSuppression(index), QMessageBox.Yes | QMessageBox.No
         )
         if supprimer == QMessageBox.Yes:
             self._modele.removeRow(row)
Пример #54
0
 def closeEvent(self, event):
     """
     Close event.
     """
     answer = QMessageBox.question(self, 
                                   self.tr('Quit'),
                                   self.tr('Do you want to exit Sci Corpus?'),
                                   QMessageBox.Yes | QMessageBox.No, 
                                   QMessageBox.No)
     if answer == QMessageBox.Yes:
         self.container.write_()
         self.writeSettings()
         event.accept()
     else:
         event.ignore()
Пример #55
0
 def deleteRecord(self):
     species = self.sppLineEdit.text()
     obstime = self.dateTimeEdit.dateTime().toString(
                                         DATETIME_FORMAT)
     if (QMessageBox.question(self,
             "Delete",
             "Delete observation of <br>%s on %s?" % (species, obstime),
             QMessageBox.Yes|QMessageBox.No) ==
             QMessageBox.No):
         return
     row = self.mapper.currentIndex()
     self.model.removeRow(row)
     self.model.submitAll()
     if row + 1 >= self.model.rowCount():
         row = self.model.rowCount() - 1
     self.mapper.setCurrentIndex(row)
Пример #56
0
    def closeFile(self):
        """
        Closes current file.
        """
        if self.container.isModified:
            answer = QMessageBox.question(self,
                                          self.tr('Save'),
                                          self.tr('Do you want to save the current work?'),
                                          QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel,
                                          QMessageBox.Yes)
            
            if answer == QMessageBox.Yes:
                self.container.write_()

        self.container.close_()
        self.clearAll()    
Пример #57
0
    def closeEvent(self, event):
        if self.notSavedState:
            reply = QMessageBox.question(self, 'QMessageBox.question()',
                                            'Do you want to first save the current session?',
                                            QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel)
        else:
            reply = QMessageBox.No

        if reply == QMessageBox.Yes:
            self.save()
        elif reply == QMessageBox.Cancel:
            event.ignore()
            return
      
        if not self.server.exitFlag:
            self.stop()
        event.accept()
Пример #58
0
Файл: gui.py Проект: r3/r3tagger
    def closeEvent(self, event):
        if self.dirty:
            reply = QMessageBox.question(
                self,
                "r3tagger - Unsaved Changes",
                "Save unsaved changes?",
                QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel,
            )

            if reply == QMessageBox.Cancel:
                event.ignore()
                return None
            elif reply == QMessageBox.Yes:
                self.confirmChanges()

        settings = QSettings()
        settings.setValue("MainWindow/Geometry", self.saveGeometry())
        settings.setValue("MainWindow/State", self.saveState())
 def closeEvent(self, event):
     self.isExiting = True
     # stop any current running session
     if self.active:
         question = "Are you sure you want to exit the program while you are still encrypting/decrypting files?"
         response = QMessageBox.question(self, 'Exit',
                                     question,
                                     QMessageBox.StandardButton.Yes,
                                     QMessageBox.StandardButton.No)
         if response == QMessageBox.StandardButton.Yes:
             # terminate activity if any
             self.active = False
             event.accept()
         else:
             self.isExiting = False
             event.ignore()
     else:
         event.accept()
Пример #60
0
    def Apply_Clicked(self):
        SelectedItems = self.GetMarkedItems()
        textMsg = "Selektierte Dateie(n):\r\n"
        if len(SelectedItems) > 0:
            for file in SelectedItems:
                filePath = os.path.join(self.HlineInputfiles.getText(), file)
                textMsg += (file + "\r\n")
                XmlAnalysis.XmlAnalysis(filePath, self.HlineOutputfiles.getText())

            #QMessageBox.information(self, "Report", textMsg)
            textMsg += "\r\nReport-Verzeichnis öffnen?\r\n"
            msgBox = QMessageBox.StandardButton.Yes
            msgBox |= QMessageBox.StandardButton.No
            if QMessageBox.question(self, "Report", textMsg, msgBox) == QMessageBox.Yes:
                os.startfile(self.HlineOutputfiles.getText())

        else:
            QMessageBox.warning(self, "Achtung", "Keine Datei selektiert!")
            pass