Beispiel #1
0
def merge_pdf(destination=None, pdf_files=None):
    try:
        output = PdfFileWriter()
        inputs = []
        for pdf_file in pdf_files:
            reader_pdf_file = PdfFileReader(open(pdf_file, 'rb'))
            inputs.append(reader_pdf_file)

        for input_pdf in inputs:
            for page in input_pdf.pages:
                output.addPage(page)

        output_stream = open(destination, 'wb')
        output.write(output_stream)
        output_stream.close

        # merger = PdfFileMerger()
        # for pdf_file in pdf_files:
        # 	merger.append(open(pdf_file, 'rb'))

        # merger.write(open(destination), 'wb')

        QMessageBox.information(main, 'Success!',
                                'PDFs have been merged to ' + destination)
    except:
        QMessageBox.critical(
            main, 'Error!',
            'Critical error occured.\n\n%s' % traceback.format_exc())
 def do_it(self):
     QMessageBox.information(
         self, 'Do it!', 'The input was {0}'.format(self.edit.text()))
     number = float(self.edit.text())
     QMessageBox.information(
         self, 'Do it!', 'Convert to a double and add something: '
         '{0} + 2.5 = {1}'.format(number, number+2.5))
Beispiel #3
0
    def submit_data(self):
        self._model.insertRow(0)
        data = self.extract_input()
        for key,val in data.items():
            self._model.setData(self._model.index(0, self.column[key]), val)
        # try to commit a record
        if not self._model.submitAll():
            self.log.error(self._model.lastError().text())
            message = unicode("Erro de transação\n\n""Não foi possível salvar no banco de dados".decode('utf-8'))
            QMessageBox.critical(self, "Seareiros - Cadastro de Atividade", message)
            return False
        else:
            # successfully added an associate, adding it's activities
            activities = self.extract_activities_input()
            error = False
            if len(activities) > 0:
                associate_id = self.get_added_record().value("id")
                for id in activities:
                    self._act_model.insertRow(0)
                    self._act_model.setData(self._act_model.index(0, 0), associate_id)
                    self._act_model.setData(self._act_model.index(0, 1), id)
                    ok = self._act_model.submitAll()
                    if not ok:
                        error = True
                        self.log.error(self._act_model.lastError().text())
            if not error:
                message = unicode("Sucesso!\n\n""O associado foi salvo com êxito no banco de dados".decode('utf-8'))
                QMessageBox.information(self, "Seareiros - Cadastro de Associado", message)
            else:
                message = unicode("Erro\n\n""Associado cadastrado, "
                                  "porém ocorreu um problema ao salvar suas atividades".decode('utf-8'))
                QMessageBox.warning(self, "Seareiros - Cadastro de Associado", message)

            return True
Beispiel #4
0
    def mouseReleaseEvent(self, event):
        super().mouseReleaseEvent(event)

        pos = event.pos()
        x, y = pos.x() // self.cell_size, pos.y() // self.cell_size

        # Нельзя изменять дефолтную ячейку
        try:
            if not self.def_num_matrix[x][y]:
                if event.button() == Qt.LeftButton:
                    self.matrix[x][y] = self.matrix[x][y] + 1 if self.matrix[x][y] < 9 else 0
                elif event.button() == Qt.RightButton:
                    self.matrix[x][y] = self.matrix[x][y] - 1 if self.matrix[x][y] > 0 else 9
                elif event.button() == Qt.MiddleButton:
                    self.matrix[x][y] = 0

                # Получим список решения этой судоку
                for solution in self.sudoku_solutions:
                    if solution == self.matrix:
                        QMessageBox.information(None, 'Победа', 'Совпало, мать его!')
                        break

                self.update()

        except IndexError:
            pass
Beispiel #5
0
    def on_pushButtonEnviar_clicked(self):

        sCF = self.lineEditQtdCF.text() # recebe Quantidade de Cupom Fiscal do LineEdit
        sItem = self.lineEditQtdItem.text() # recebe Quantidade de Item do LineEdit

        regAlterarValor_Daruma("ECF\\RetornarAvisoErro","1")
        iRetornoAbrir = iCFAbrirPadrao_ECF_Daruma()

        if (iRetornoAbrir == 1):
            for cf in range(1,sCF):
                 iCFAbrirPadrao_ECF_Daruma()

                 for item in range(1,sItem):
                     #QMessageBox.information(self,"DarumaFramework - Python/Qt","Entrou no vender")
                     iRetorno = iCFVender_ECF_Daruma("I1","1,00","1,00","D$","0,00","123456789012","UN","ITEM")

                 iCFTotalizarCupomPadrao_ECF_Daruma()
                 iCFEfetuarPagamentoPadrao_ECF_Daruma()
                 iCFEncerrar_ECF_Daruma("0","Teste de Venda de Item Sem Parar. Mensagem Promocional com até 8 linhas!")
            QMessageBox.information(self,"DarumaFramework - Python/Qt","Processo Concluido.")

        if (iRetornoAbrir != 1):
            tratarRetornoFiscal(iRetornoAbrir, self)
            QMessageBox.warning(self,"DarumaFramework - Python/Qt","Erro  Primeira Venda. Cancelando Processo")
            iCFCancelar_ECF_Daruma()


        if ((sCF == "") and (sItem =="")):
            QMessageBox.information(self,"DarumaFramework - Python/Qt","Preencha todos os campos!")
Beispiel #6
0
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        self.serviceProvider = 0
        self.popupMenu = None
        self.mapControlButtons = []
        self.mapControlTypes = []
        self.markerObjects = []
        self.setWindowTitle(self.tr('Map Viewer Demo'))

        self.routingManager = None
        self.mapManager = None
        self.mapWidget = None
        self.markerIcon = None
        self.slider = None

        manager = QNetworkConfigurationManager()

        canStartIAP = manager.capabilities() & QNetworkConfigurationManager.CanStartAndStopInterfaces

        configuration = manager.defaultConfiguration()

        if not configuration.isValid or (not canStartIAP and configuration.starte() != QNetworkConfiguration.Active):
            QMessageBox.information(self, self.tr('Map Viewer Demo'),
                                    self.tr('Available Access Points not found.'))
            return

        self.session = QNetworkSession(configuration, self)
        self.session.opened.connect(self.networkSessionOpened)
        self.session.error.connect(self.error)

        self.session.open()
        self.session.waitForOpened()

        self.setProvider('nokia')
        self.setupUi()
Beispiel #7
0
def merge_pdf(destination=None, pdf_files=None):
	try:
		output = PdfFileWriter()
		inputs = []
		for pdf_file in pdf_files:
			reader_pdf_file = PdfFileReader(open(pdf_file, 'rb'))
			inputs.append(reader_pdf_file)

		for input_pdf in inputs:
			for page in input_pdf.pages:
				output.addPage(page)

		output_stream = open(destination, 'wb')
		output.write(output_stream)
		output_stream.close

		# merger = PdfFileMerger()
		# for pdf_file in pdf_files:
		# 	merger.append(open(pdf_file, 'rb'))
		
		# merger.write(open(destination), 'wb')

		QMessageBox.information(main, 'Success!', 'PDFs have been merged to ' + destination )
	except:
		QMessageBox.critical(main, 'Error!', 'Critical error occured.\n\n%s' % traceback.format_exc())
Beispiel #8
0
 def fileLockedEvent(self, fileName):
     msgSuccess = "{0} locked successfully.".format(fileName)
     QMessageBox.information(self, __appname__, msgSuccess)
     self.lockButton.setText("Lock EXE")
     self.lockButton.setEnabled(True)
     self.groupBox.setEnabled(True)
     self.step1GroupBox.setEnabled(True)
Beispiel #9
0
 def fileLockedEvent(self, fileName):
     msgSuccess = "{0} locked successfully.".format(fileName)
     QMessageBox.information(self, __appname__, msgSuccess)
     self.lockButton.setText("Lock EXE")
     self.lockButton.setEnabled(True)
     self.groupBox.setEnabled(True)
     self.step1GroupBox.setEnabled(True)
Beispiel #10
0
    def _modify_changes(self, modify_row_idx=None):
        # Early out if the user clicked edit without selecting a row
        if modify_row_idx == -1:
            return

        table = self.form.changesView
        obj = None
        sel_prop = None
        sel_val = None

        if modify_row_idx is not None and modify_row_idx >= 0:
            sel_obj = table.item(modify_row_idx, 0).text()
            sel_prop = table.item(modify_row_idx, 1).text()
            sel_val = table.item(modify_row_idx, 2).text()
            obj = FreeCAD.ActiveDocument.getObject(sel_obj)
        else:
            modify_row_idx = -1
            obj = self._select_object()

        if not obj:
            QMessageBox.information(None, MSGBOX_TITLE, "No object found")
            return

        f = AddChangeWindow(obj, sel_prop, sel_val)
        if f.form.exec_():
            self._add_or_modify_change(obj.Label, f.prop, f.value, f.type, modify_row_idx)
            # TODO: we don't have to re-read the whole table every time
            self._settings.changes = self._read_changes_from_table()
Beispiel #11
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)
Beispiel #12
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)
Beispiel #13
0
 def add_menu(self):
     """
     adds the new menu item
     :return:none
     """
     logger.info('MenuAddDialogue add new menu initiated')
     name = self.dialogue.menudialogue_itemname_linedit.text()
     rate = self.dialogue.menudialogue_rate_lineedit.text()
     id = self.id if self.id else self.dialogue.menudialogue_codenumber_linedit.text()
     category = self.dialogue.menudialogue_itemcategory_combobox.currentText()
     serve = self.dialogue.menudialogue_serve_lineedit.text()
     obj = {'name': name, 'rate': rate, 'id': id, 'category': category, 'serve': serve}
     for i, j in obj.iteritems():
         if j == '':
             QMessageBox.critical(QMessageBox(), 'Error', 'Invalid %s value' % i.title(), QMessageBox.Ok)
             return False
     if self.editable:
         ret = self.menuproduct.update_dish(obj)
     else:
         ret = self.menuproduct.new_dish(obj)
     if not ret:
         QMessageBox.critical(QMessageBox(), 'Error', 'Duplicate Entry', QMessageBox.Ok)
         return False
     else:
         QMessageBox.information(QMessageBox(), 'Success', 'Dish Saved', QMessageBox.Ok)
         self.edit_mode(id, False)
         self.parent.update_menu()
Beispiel #14
0
 def saveConfigButtonClicked(self):
     """
     save the config to conf/default.ini
     """
     ret = QMessageBox.warning(self, u"警告", u"确定要保存吗",
                               QMessageBox.Yes | QMessageBox.No)
     if ret == QMessageBox.No:
         return
     if not os.path.isdir('conf'):
         os.mkdir('conf')
     files = QFileDialog.getSaveFileName(
         self,
         u"保存配置文件",
         "conf/default.ini",
         "INI File (*.ini)",
     )
     filename = files[0]
     if filename:
         try:
             file = open(filename, 'w')
             self.saveConfig(file)
         except Exception, e:
             QMessageBox.information(self, u'保存失败', u'文件选择错误' + str(e))
             return
         finally:
Beispiel #15
0
    def tipsSection(self):
        """Show tips for the section."""
        QMessageBox.information(
            self, self.tr('Section Tips'),
            self.tr('Sections are the main division of a \
scientific text. In summary, they are the titles of each section.'),
            QMessageBox.Ok)
Beispiel #16
0
    def tipsComponent(self):
        """Show tips for Component."""
        QMessageBox.information(
            self, self.tr('Component Tips'),
            self.tr('Component are a sub division of the section.\
\n\nAs an example, section Introduction has a Contextualization, Gap and Propose Components \
in an article.'), QMessageBox.Ok)
Beispiel #17
0
    def getSampleData(self, sampleAmount, curSampleIndex):
        """
        Collect sample data and add the sniffed data to ``rawData[curSampleIndex]``.
        Uses the processes/threads started using :func:`startSnifferAndAdder`.

        :param sampleAmount: Amount of samples to collect
        :param curSampleIndex: Index of the currently captured sample in ``rawData``
        """

        # Append a new list for the current sample run
        self.rawData.append([])

        # Display another text in the last round
        if curSampleIndex == range(sampleAmount)[-1]:
            messageBoxText = Strings.filterTabSniffingLastSampleMessageBoxText
        else:
            messageBoxText = Strings.filterTabSniffingMessageBoxText

        self.startSnifferAndAdder(self.addSniffedPacketToSample,
                                  curSampleIndex)

        # Sniff and wait for the user to do an action
        QMessageBox.information(
            Globals.ui.tableViewFilterData,
            Strings.filterTabSniffingMessageBoxTitle + " (" +
            str(curSampleIndex + 1) + "/" + str(sampleAmount) + ")",
            messageBoxText, QMessageBox.Ok)

        self.stopSnifferAndAdder()
Beispiel #18
0
    def on_pushButtonEnviar_clicked(self):
        # Pega o indice da ComboBox
        iIndice = self.comboBoxAdicional.currentIndex()

        # Pega o texto do TextEdit
        StrMensagem = self.lineEditMensagem.text()

        if (iIndice == 0):
            QMessageBox.information(self, "DarumaFramework - Python/Qt",
                                    "Preencha o Tipo de Cupom Adicional")

        if (StrMensagem == ""):
            QMessageBox.information(self, "DarumaFramework - Python/Qt",
                                    "Preencha a Mensagem Promocional")

        if (iIndice == 1):
            StrCAdicional = "0"
        elif (iIndice == 2):
            StrCAdicional = "1"
        elif (iIndice == 3):
            StrCAdicional = "2"
        elif (iIndice == 4):
            StrCAdicional = "3"

        tratarRetornoFiscal(iCFEncerrar_ECF_Daruma(StrCAdicional, StrMensagem),
                            self)
Beispiel #19
0
    def on_pushButtonParametrizar_clicked(self):
        StrEndereco = self.lineEditEndereco.text()
        StrNumero = self.lineEditNumero.text()
        StrComplemento = self.lineEditComplemento.text()
        StrBairro = self.lineEditBairro.text()
        StrCEP = self.lineEditCEP.text()
        StrMunicipio = self.lineEditMunicipio.text()
        StrUF = self.comboBoxUF.currentText()
        StrTelefone = self.lineEditTelefone.text()
        StrFAX = self.lineEditFAX.text()
        StrNome = self.lineEditNomeContato.text()
        StrFinalidade = self.comboBoxFinalidade.currentText()
        StrConvenio = self.comboBoxIdentificacaoConvenio.currentText()
        StrNatureza = self.comboBoxNaturezaOperacao.currentText()

        regAlterarValor_Daruma("ECF\\SINTEGRA\\Bairro", StrBairro)
        regAlterarValor_Daruma("ECF\\SINTEGRA\\CEP", StrCEP)
        regAlterarValor_Daruma("ECF\\SINTEGRA\\Cod_Finalidade", StrFinalidade)
        regAlterarValor_Daruma("ECF\\SINTEGRA\\Cod_Convenio", StrConvenio)
        regAlterarValor_Daruma("ECF\\SINTEGRA\\Cod_Natureza", StrNatureza)
        regAlterarValor_Daruma("ECF\\SINTEGRA\\Complemento", StrComplemento)
        regAlterarValor_Daruma("ECF\\SINTEGRA\\Contato_Nome", StrNome)
        regAlterarValor_Daruma("ECF\\SINTEGRA\\Contato_Telefone", StrTelefone)
        regAlterarValor_Daruma("ECF\\SINTEGRA\\Fax", StrFAX)
        regAlterarValor_Daruma("ECF\\SINTEGRA\\Logradouro", StrEndereco)
        regAlterarValor_Daruma("ECF\\SINTEGRA\\Municipio", StrMunicipio)
        regAlterarValor_Daruma("ECF\\SINTEGRA\\Numero", StrNumero)
        regAlterarValor_Daruma("ECF\\SINTEGRA\\UF", StrUF)

        QMessageBox.information(self, "DarumaFramework - Python/Qt",
                                "Parametrização Concluída.")
        self.close()
Beispiel #20
0
 def fileUnlockedEvent(self, success, decryptedFileName):
     if success == 'True':
         QMessageBox.information(self, __appname__, "File Unlocked Successfully.")
     else:
         os.remove(decryptedFileName)
         EncryptedFile.replaceWithUnlockDialog(EncryptedFile.CALLER_LOCATION, decryptedFileName)
         QMessageBox.information(self, __appname__, "Wrong password. Couldn't unlock file.")
Beispiel #21
0
    def startTraining(self, stopWords):
        count_term_tag = defaultdict(lambda: defaultdict(list))

        for filePath in self.files:
            fileName = os.path.split(filePath)[1]
            data = open(filePath).read().decode('GB18030').split()
            tag = self.file_tag_map[fileName]
            self.tag_count[tag] += 1
            for term in data:
                if term in stopWords or term[0] < u'\u4e00' or term[
                        0] > u'\u9fa5':
                    continue
                if fileName not in count_term_tag[term][tag]:
                    count_term_tag[term][tag].append(fileName)

        for tag in self.tags:
            for term in count_term_tag.keys():
                self.df[tag][term] = len(count_term_tag[term][tag])

        for tag in self.tags:
            self.feature[tag] = map(
                itemgetter(0),
                sorted(self.df[tag].iteritems(),
                       key=itemgetter(1),
                       reverse=True)[:100])
            for term in self.feature[tag]:
                self.prob[term][tag] = 1.0 * (self.df[tag][term] +
                                              1) / (self.tag_count[tag] + 2)

        QMessageBox.information(None, u'训练完成', u'训练完成,可以开始分类了')
Beispiel #22
0
 def do_it(self):
     QMessageBox.information(self, 'Do it!',
                             'The input was {0}'.format(self.edit.text()))
     number = float(self.edit.text())
     QMessageBox.information(
         self, 'Do it!', 'Convert to a double and add something: '
         '{0} + 2.5 = {1}'.format(number, number + 2.5))
Beispiel #23
0
 def addToNormalGroup(self):
     self.state.maybeSave()
     eid = self.state.viewAllPanel.view.selectedEid
     groups = set(self.state.model.normalGroups())
     inGroups = set(self.state.model.groupsForEid(eid))
     groups = sorted(groups - inGroups, key=lambda g: g[1].casefold())
     names = [g[1] for g in groups]
     if not names:  # Could happen if already in all the groups
         message = ("There are no other groups for this entry "
                    "to be added to.")
         QMessageBox.information(
             self.window,
             "Can't Link — {}".format(QApplication.applicationName()),
             message)
         return
     name, ok = QInputDialog.getItem(
         self.window,
         "Add to Normal Group — {}".format(QApplication.applicationName()),
         "Normal Group", names, 0, False)
     if ok:
         for gid, gname in groups:
             if gname == name:
                 self.state.model.addToGroup(eid, gid)
                 self.state.viewAllPanel.view.gotoEid(eid)
                 break
Beispiel #24
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)
Beispiel #25
0
 def addToLinkedGroup(self):
     self.state.maybeSave()
     eid = self.state.viewAllPanel.view.selectedEid
     groups = set(self.state.model.linkedGroups())
     inGroups = set(self.state.model.groupsForEid(eid))
     groups = sorted(groups - inGroups, key=lambda g: g[1].casefold())
     names = [
         g[1] for g in groups
         if self.state.model.safeToAddToGroup(eid, g[0])
     ]
     if not names:
         if self.state.model.linkedGroup(eid) is not None:
             message = "This entry is already in a linked group."
         else:
             message = ("There are no linked groups for this entry "
                        "to be added to.")
         QMessageBox.information(
             self.window,
             "Can't Link — {}".format(QApplication.applicationName()),
             message)
     else:
         name, ok = QInputDialog.getItem(
             self.window, "Add to Linked Group — {}".format(
                 QApplication.applicationName()), "Linked Group", names, 0,
             False)
         if ok:
             for gid, gname in groups:
                 if gname == name:
                     self.state.model.addToGroup(eid, gid)
                     self.state.viewAllPanel.view.gotoEid(eid)
                     break
Beispiel #26
0
	def beginScan(self):
		global infectionsList
		global infectedFiles
		global infectionsList
		self._theMainWindow.theScan.theScanProgress.theShowScanResults.tableWidget.clear()
		self.isCleanScan = False
		global scanPath
		global abnormalTermination
		global scanParameters
		self.getScanSettings()
		infectedFiles = []
		infectionsList = []
		abnormalTermination = 0
		self._theMainWindow.theScan.theScanProgress.btnExitScan.setText(langmodule.terminateScan)
		#print("Scan path is: " + str(scanPath))
		if scanPath == None:
			QMessageBox.information(None, langmodule.attention, langmodule.noFilesChosen, 
								 QMessageBox.Ok | QMessageBox.Default, QMessageBox.NoButton)
			return -1
		
		# preparing to start scan in a new thread
		self.theScanWorker = utilities.scanWorker(scanPath, scanParameters)
		#self.theScanWorker.finished.connect(self.onScanFinish)
		self.theScanWorker.sigWriteScan.connect(self.printToWidget)
		self.theScanWorker.sigScanTerminated.connect(self.onScanFinish)
		
		self._theMainWindow.theScan.theScanProgress.textScanProg.clear()
		self._theMainWindow.theScan.theScanProgress.show()
		self.theScanWorker.start()
			
		#preparing to store scan event in a new thread
		self.theSQLITEWorker = utilities.sqliteWorker()
		self.theSQLITEWorker.finished.connect(self.onSQLiteFinish)
def tratarRetornoModem(iRetorno, Janela):

    RetornoMetodo = ''
    if (iRetorno == 0):
        RetornoMetodo = 'Tratamento de Retorno - DarumaFramework Python/Qt','Retorno 0 - Erro de comunicação, não foi possível enviar o método.'
    elif (iRetorno == 1):
        RetornoMetodo = 'Tratamento de Retorno - DarumaFramework Python/Qt','Retorno 1 - Operação realizada com sucesso!!'
    elif (iRetorno == -1):
        RetornoMetodo = 'Tratamento de Retorno - DarumaFramework Python/Qt','Retorno -1 - Erro na comunicação da serial.'
    elif (iRetorno == -2):
        RetornoMetodo = 'Tratamento de Retorno - DarumaFramework Python/Qt','Retorno -2 - Modem retornou erro.'
    elif (iRetorno == -3):
        RetornoMetodo = 'Tratamento de Retorno - DarumaFramework Python/Qt','Retorno -3 - Modem retornou caractere(s) inválido(s).'
    elif (iRetorno == -4):
        RetornoMetodo = 'Tratamento de Retorno - DarumaFramework Python/Qt','Retorno -4 - Modem não conectado na rede GSM.'
    elif (iRetorno == -5):
        RetornoMetodo = 'Tratamento de Retorno - DarumaFramework Python/Qt','Retorno -5 - Modem retornou NO CARRIER.'
    elif (iRetorno == -6):
        RetornoMetodo = 'Tratamento de Retorno - DarumaFramework Python/Qt','Retorno -6 - Modem retornou NO DIALTONE.'
    elif (iRetorno == -7):
        RetornoMetodo = 'Tratamento de Retorno - DarumaFramework Python/Qt','Retorno -7 - Modem retornou BUSY.'

    if (iRetorno > 1):
        QMessageBox.information(Janela,'Tratamento de Retorno - DarumaFramework Python/Qt',' O nivel de sinal é: ' + str(iRetorno))
    else:
        QMessageBox.information(Janela, 'Tratamento Retorno - Genérico','Retorno do Método: ' + str(RetornoMetodo))
Beispiel #28
0
 def _select_object(self):
     selection = FreeCADGui.Selection.getSelection()
     if selection and len(selection) == 1:
         return selection[0]
     else:
         QMessageBox.information(None, MSGBOX_TITLE, "Select a single object")
         return None
Beispiel #29
0
def tratarRetornoModem(iRetorno, Janela):

    RetornoMetodo = ''
    if (iRetorno == 0):
        RetornoMetodo = 'Tratamento de Retorno - DarumaFramework Python/Qt', 'Retorno 0 - Erro de comunicação, não foi possível enviar o método.'
    elif (iRetorno == 1):
        RetornoMetodo = 'Tratamento de Retorno - DarumaFramework Python/Qt', 'Retorno 1 - Operação realizada com sucesso!!'
    elif (iRetorno == -1):
        RetornoMetodo = 'Tratamento de Retorno - DarumaFramework Python/Qt', 'Retorno -1 - Erro na comunicação da serial.'
    elif (iRetorno == -2):
        RetornoMetodo = 'Tratamento de Retorno - DarumaFramework Python/Qt', 'Retorno -2 - Modem retornou erro.'
    elif (iRetorno == -3):
        RetornoMetodo = 'Tratamento de Retorno - DarumaFramework Python/Qt', 'Retorno -3 - Modem retornou caractere(s) inválido(s).'
    elif (iRetorno == -4):
        RetornoMetodo = 'Tratamento de Retorno - DarumaFramework Python/Qt', 'Retorno -4 - Modem não conectado na rede GSM.'
    elif (iRetorno == -5):
        RetornoMetodo = 'Tratamento de Retorno - DarumaFramework Python/Qt', 'Retorno -5 - Modem retornou NO CARRIER.'
    elif (iRetorno == -6):
        RetornoMetodo = 'Tratamento de Retorno - DarumaFramework Python/Qt', 'Retorno -6 - Modem retornou NO DIALTONE.'
    elif (iRetorno == -7):
        RetornoMetodo = 'Tratamento de Retorno - DarumaFramework Python/Qt', 'Retorno -7 - Modem retornou BUSY.'

    if (iRetorno > 1):
        QMessageBox.information(
            Janela, 'Tratamento de Retorno - DarumaFramework Python/Qt',
            ' O nivel de sinal é: ' + str(iRetorno))
    else:
        QMessageBox.information(Janela, 'Tratamento Retorno - Genérico',
                                'Retorno do Método: ' + str(RetornoMetodo))
def tratarRetornoFiscal(iRetorno, Janela):
    QStrMensagem = ''
    iRetornoLocal = iRetorno
    cInterpretaErro = create_string_buffer(300)
    cInterpretaAviso = create_string_buffer(300)
    cInterpretaRetorno = create_string_buffer(200)

    #ESTE MÉTODO VERIFICA O STATUS DO ULTIMO COMANDO, E INTERPRETA OS INDICES DE AVISO E ERRO.
    eRetornarAvisoErroUltimoCMD_ECF_Daruma(bytes(cInterpretaAviso),
                                           bytes(cInterpretaErro))
    # bug report - python stop run
    #eInterpretarRetorno_ECF_Daruma(iRetornoLocal, bytes(cInterpretaRetorno))

    QStrMensagem += "Retorno do Metodo: "
    QStrMensagem += cInterpretaRetorno.value.decode('latin-1')
    QStrMensagem += "\n"
    QStrMensagem += "Erro: "
    QStrMensagem += cInterpretaErro.value.decode('latin-1')
    QStrMensagem += "\n"
    QStrMensagem += "Aviso: "
    QStrMensagem += cInterpretaAviso.value.decode('latin-1')
    QStrMensagem += "\n"

    QMessageBox.information(
        Janela, "Tratamento de Retorno - DarumaFramework Python/Qt",
        QStrMensagem)
    return 0
Beispiel #31
0
    def convert(self):
        ''' Converts the input file and writes to the output file. '''

        input_path = self.input_path.text()
        # Should be set below when opening input the file.
        output_path = self.output_path.text()

        try:
            input_path, output_path = validate(input_path, output_path)
        except OutputExistsError as e:
            # E128 Technically this should be indented more, but I feel that
            # hurts readability in this case.
            overwrite = QMessageBox.warning(self,
                self.tr('JWPCE conversion'),
                self.tr('The output file already exits. Overwrite it?'),
                QMessageBox.Yes | QMessageBox.No)  # noqa: E128

            if overwrite == QMessageBox.No:
                return

        except ValidateError as e:
            QMessageBox.warning(self,
                                self.tr('JWPCE conversion'),
                                self.tr(str(e)),
                                QMessageBox.Ok)
            return

        # TODO - add in some kind of progress indicator?
        contents = read_file(input_path)
        write_file(output_path, contents)

        QMessageBox.information(self,
                                self.tr('JWPCE conversion'),
                                self.tr('The conversion is complete.'),
                                QMessageBox.Ok)
Beispiel #32
0
    def _find_mesh_and_analysis_objects(self, complain=True):
        found_something = False
        f = self.form
        mesh = find_object_by_typeid(TYPEID_FEM_MESH)
        an = find_object_by_typeid(TYPEID_FEM_ANALYSIS)
        solver = find_object_by_typeid(TYPEID_FEM_SOLVER)

        if mesh:
            found_something = True
            self._set_objects_tab_val("_fem_mesh", GmshTools(mesh), f.meshEdit, None, mesh.Label)
            print(f"Found mesh {mesh.Label}")
        if an:
            found_something = True
            self._set_objects_tab_val("_fem_analysis", an, f.analysisEdit)
            print(f"Found analysis {an.Label}")
        if solver:
            found_something = True
            self._set_objects_tab_val("_fem_solver", solver, f.solverEdit)
            print(f"Found solver {solver.Label}")

        if not found_something:
            print(f"Did not autofind any objects!!")
            if complain:
                QMessageBox.information(None, MSGBOX_TITLE, "Did not find any objects")

        return mesh and an
Beispiel #33
0
 def submit_data(self):
     data = self.extract_input()
     # checking fields that aren't inserted yet
     for val, model in [
         ("author", self._author_model),
         ("s_author", self._s_author_model),
         ("publisher", self._publisher_model),
     ]:
         if isinstance(data[val], unicode):
             # needs to be inserted
             model.insertRow(0)
             model.setData(model.index(0, 1), data[val])
             data[val] = submit_and_get_id(self, model, self.log)
             if not data[val]:
                 # won't proceed if this fails
                 return False
     # filling a book row
     self._model.insertRow(0)
     for key, val in data.items():
         self._model.setData(self._model.index(0, self.column[key]), val)
     book_id = submit_and_get_id(self, self._model, self.log)
     if book_id:
         # for use in selection docks
         self.setBookId(book_id)
         # book sucessfully added, now associating related subjects
         subjects, new_subjects = self.extract_subjects_input()
         for subj in new_subjects:
             self._subject_model.insertRow(0)
             self._subject_model.setData(self._subject_model.index(0, 1), subj)
             id = submit_and_get_id(self, self._subject_model, self.log)
             if not id:
                 # issue saving new subject
                 return False
             subjects.append(int(id))
         # associating book and it's subjects
         error = False
         for subj_id in subjects:
             self._book_in_subj_model.insertRow(0)
             self._book_in_subj_model.setData(self._book_in_subj_model.index(0, 0), book_id)
             self._book_in_subj_model.setData(self._book_in_subj_model.index(0, 1), subj_id)
             ok = self._book_in_subj_model.submitAll()
             if not ok:
                 error = True
                 break
         if error:
             self.log.error(self._book_in_subj_model.lastError.text())
             message = unicode(
                 "Erro\n\n"
                 "Livro cadastrado, porém ocorreu um problema ao"
                 " salvar os temas a que está associado".decode("utf-8")
             )
             QMessageBox.warning(self, "Seareiros - Cadastro de Livro", message)
             return False
         else:
             message = unicode("Sucesso!\n\n" "O livro foi salvo com êxito no banco de dados".decode("utf-8"))
             QMessageBox.information(self, "Seareiros - Cadastro de Livro", message)
             return True
     # failed to insert a row
     return False
Beispiel #34
0
 def submit_data(self):
     # I should block empty orders I guess
     if len(self._product_list) == 0:
         message = unicode(
             "Venda vazia!\n\n" "" "É necessário adicionar um produto antes de concluir uma venda".decode("utf-8")
         )
         QMessageBox.critical(self, "Seareiros - Vendas do Bazar", message)
         self.edProductName.setFocus()
         return False
     data = self.extract_input()
     # filling a product order
     self._model.insertRow(0)
     for key, val in data.items():
         self._model.setData(self._model.index(0, self.column[key]), val)
     order_id = submit_and_get_id(self, self._model, self.log)
     if order_id:
         # order creation success, placing items
         error = False
         for item in self._product_list:
             product_name = item[0]
             product_price = item[1]
             product_quantity = item[2]
             self._items_model.insertRow(0)
             self._items_model.setData(self._items_model.index(0, 1), order_id)
             self._items_model.setData(self._items_model.index(0, 2), product_name)
             self._items_model.setData(self._items_model.index(0, 3), product_price)
             self._items_model.setData(self._items_model.index(0, 4), product_quantity)
             ok = self._items_model.submitAll()
             if not ok:
                 error = True
                 break
         if error:
             self.log.error(self._items_model.lastError().text())
             message = unicode(
                 "Erro\n\n"
                 "Venda registrada e contabilizada, porém ocorreu um problema e"
                 " não será possível visualizar seus itens.".decode("utf-8")
             )
             QMessageBox.warning(self, "Seareiros - Vendas do Bazar", message)
             return False
         else:
             # all went fine
             # retrieving some brief info of the order to display at the main window
             if "associate" in data:
                 desc = "Venda do bazar no valor de R$ %s para %s" % (
                     self._locale.toString(data["total"], "f", 2).replace(".", ""),
                     self.lblNickname.text(),
                 )
             else:
                 desc = "Venda do bazar no valor de R$ %s" % self._locale.toString(data["total"], "f", 2).replace(
                     ".", ""
                 )
             if not log_to_history(self._model.database(), "venda_bazar", order_id, desc):
                 self.log.error(self._model.lastError().text())
             message = unicode("Sucesso!\n\n" "Venda concluída.".decode("utf-8"))
             QMessageBox.information(self, "Seareiros - Vendas do Bazar", message)
             return True
     # failed to insert a row
     return False
    def on_pushButtonEnviar_clicked(self):

        if(self.lineEditCaption.text() != ""):
            StrCaption = self.lineEditCaption.text()

            eTEF_SetarFoco_ECF_Daruma(StrCaption)
        else:
            QMessageBox.information(self, "DarumaFramework - Python/Qt","Entre com o Titulo da Janela!")
Beispiel #36
0
	def deleteallhist(self, i):
		if i == 0:
			pass
		elif i == 2:
			self.histli.clear()
			self.histlis = [0]
			cur.execute("delete from HISTORY")
			QMessageBox.information(self, self.windowTitle(), "All the History Records are deleted. . .")
Beispiel #37
0
    def enterWhenReady(self):
        """
        Block the GUI thread until the user pressed the button on the MessageBox.
        """

        QMessageBox.information(
            self.tabWidget, Strings.searcherTabEnterWhenReadyMessageBoxTitle,
            Strings.searcherTabEnterWhenReadyMessageBoxText, QMessageBox.Ok)
Beispiel #38
0
    def handle_click(self, x: int, y: int):
        self._game.play_at(x, y)
        self.update_all_buttons()

        if self._game.finished():
            QMessageBox.information(self, self.tr('Game finished'),
                                    self.tr(self._game.message()))
            self.window().close()
 def on_pushButtonEnviar_clicked(self):
     QMessageBox.information(self, "DarumaFramework - Python/Qt!","Vou Travar o Teclado!")
     bTravar = True
     eTEF_TravarTeclado_ECF_Daruma(bTravar)
     time.sleep(5)
     bTravar = False
     eTEF_TravarTeclado_ECF_Daruma(bTravar)
     QMessageBox.information(self, "DarumaFramework - Python/Qt!", "Teclado Destravado!")
Beispiel #40
0
 def notImplementedYet(self):
     """
     Show tips for function.
     """
     QMessageBox.information(self, 
                     self.tr('Sorry'),
                     self.tr('We have no implemented this function yet.'),
                     QMessageBox.Ok)
 def on_eDefinirProduto_Daruma_triggered(self):
     iRetorno = eDefinirProduto_Daruma("MODEM")
     if (iRetorno == 1):
         QMessageBox.information(self, "Método eDefinirProduto_Daruma",
                                 "Produto definido com sucesso!")
     else:
         QMessageBox.information(self, "Método eDefinirProduto_Daruma",
                                 "Erro na definição de produto!")
Beispiel #42
0
 def tipsFunction(self):
     """
     Show tips for function.
     """
     QMessageBox.information(self, 
                     self.tr('Function Tips'),
                     self.tr('Function explain what each sentence is.'),
                     QMessageBox.Ok)
 def doScrape(self):
     if not self.validateInput():
         return
     Con = self.buildInput()
     QMessageBox.information(self, 'Starting...', 'Starting Scrape, Please be patient !!!')
     self.timer.start(100)
     p = Process(target=doScrape, args=(Con, self.q))
     p.daemon = True
     p.start()
Beispiel #44
0
 def _discoverFinished(self):
     'Discover Thread Finished'
     self._btnRefresh.setEnabled(True)
     self._btnRefresh.setText(self.tr('&Refresh List'))
     
     if self._model.rowCount() == 0:
         QMessageBox.information(self, self.tr('No Devices Found'),
             self.tr('No Dive Computers were found using the specified driver.  Please ensure your device is connected and press Refresh List.'),
             QMessageBox.Ok, QMessageBox.Ok)
Beispiel #45
0
    def tipsSection(self):
        """
        Show tips for the section.
        """    
        QMessageBox.information(self, 
                                self.tr('Section Tips'),
                                self.tr('Sections are the main division of a \
scientific text. In summary, they are the titles of each section.'),
                                QMessageBox.Ok)
    def on_pushButtonEnviar_clicked(self):
        # Declaraçao das Variaveis que recebem os valores da UI
        StrNumItem =  self.lineEditNumeroItem.text()

        if(StrNumItem ==""):
            QMessageBox.information(self, "DarumaFramework - Python/Qt","Preencha todos os Campos")
        else:
            # Chamada do Método
            tratarRetornoFiscal(iCNFCancelarAcrescimoItem_ECF_Daruma(StrNumItem), self)
Beispiel #47
0
 def handle_click(self, x: int, y: int):
     self._game.play_at(x, y)
     self.update_all_buttons()
     
     if self._game.finished():
         QMessageBox.information(self,
                                 self.tr('Game finished'),
                                 self.tr(self._game.message()))
         self.window().close()
    def on_pushButtonEnviar_clicked(self):
        # Declaraçao das Variaveis que recebem os valores da UI
        StrNumItem =  self.lineEditNumeroItem.text()

        if(StrNumItem ==""):
            QMessageBox.information(self, "DarumaFramework - Python/Qt","Preencha todos os Campos")
        else:
            #Chamada do Método
            tratarRetornoFiscal(iCNFCancelarDescontoItem_ECF_Daruma(StrNumItem), self)
    def on_pushButtonEnviar_clicked(self):
        # Variaveis que irão receber os valores dos lineEdits
        StrRelatorios = ''
        if (self.checkBoxMF.isChecked(self)):
            StrRelatorios += "MF+"
        if (self.checkBoxMFD.isChecked(self)):
            StrRelatorios += "MFD+"
        if (self.checkBoxTDM.isChecked(self)):
            StrRelatorios += "TDM+"
        if (self.checkBoxNFP.isChecked(self)):
            StrRelatorios += "NFP+"
        if (self.checkBoxNFPTDM.isChecked(self)):
            StrRelatorios += "NFPTDM+"
        if (self.checkBoxSINTEGRA.isChecked(self)):
            StrRelatorios += "SINTEGRA+"
        if (self.checkBoxSPED.isChecked(self)):
            StrRelatorios += "SPED+"
        if (self.checkBoxLMFC.isChecked(self)):
            StrRelatorios += "LFMC+"
        if (self.checkBoxLMFS.isChecked(self)):
            StrRelatorios += "LMFS+"
        if (self.checkBoxVIVANOTA.isChecked(self)):
            StrRelatorios += "VIVANOTA+"
        if (self.checkBoxEAD.isChecked(self)):
            StrRelatorios += "[EAD]"
            if (self.lineEditArquivoKey.text() == ""):
                QMessageBox.information(
                    self, "DarumaFramework - Python/Qt",
                    "Você selecionou EAD. Insira o local do arqivo .Key")
            else:
                StrRelatorios += (self.lineEditArquivoKey.text())

        if (self.lineEditLocalArquivos.text() != ""):
            StrLocal = self.lineEditLocalArquivos.text()

            regAlterarValor_Daruma("START\\LocalArquivosRelatorios", StrLocal)

        if (self.radioButtonCOO.isChecked(self)
                and self.radioButtonCRZ.isChecked(self)
                and self.radioButtonDATAM.isChecked(self)):
            StrInicial = self.lineEditInicial.text()
            StrFinal = self.lineEditFinal.text()
            if (self.radioButtonCOO.isChecked(self)):
                StrTipoIntervalo = "COO"
            else:
                #if(self.radioButtonCRZ.isChecked(self)):
                StrTipoIntervalo = "CRZ"
            if (self.radioButtonDATAM.isChecked(self)):
                StrInicial = self.dateEditInicial.text()
                StrFinal = self.dateEditFinal.text()
                StrTipoIntervalo = "DATAM"

            # Execuçao do Metodo
            tratarRetornoFiscal(
                rGerarRelatorio_ECF_Daruma(StrRelatorios, StrTipoIntervalo,
                                           StrInicial, StrFinal), self)
    def on_pushButtonEnviar_clicked(self):
        # Declaraçao das Variaveis que recebem os valores da UI
        StrIndice =  self.comboBoxIndiceTotalizador.currentText()
        StrValorRecebimento = self.lineEditValorRecebimento.text()

        if((StrIndice == "Selecione...") and (StrValorRecebimento == "")):
            QMessageBox.information(self,"DarumaFramework - Python/Qt","Preencha todos os Campos")
        else:
            # Chamada do Método
            tratarRetornoFiscal(iCNFReceberSemDesc_ECF_Daruma(StrIndice,StrValorRecebimento), self)
Beispiel #51
0
    def writeToFile(self, filename):
        """ Save all contacts in the model to a file. """
        try:
            f = open(filename, "wb")
            pickle.dump(self.tableModel.addresses, f)

        except IOError:
            QMessageBox.information(self, "Unable to open file: %s" % filename)
        finally:
            f.close()       
Beispiel #52
0
    def handle_click(self, x: int, y: int):
        self._puzzle.move_pos(x, y)
        self.update_button(*self._puzzle.blank)  # args unpacking
        self.update_button(*self._puzzle.moved)

        if self._puzzle.finished:
            QMessageBox.information(self, self.tr('Congratulations'),
                                    self.tr('Game finished!'))
            self._puzzle.shuffle()
            self.update_all_buttons()
Beispiel #53
0
    def tipsSubSection(self):
        """
        Show tips for Subsection
        """
        QMessageBox.information(self, 
                                self.tr('Sub Section Tips'),
                                self.tr('Sub section are a sub division of the section.\
\n\nAs an example, section Introduction has a Contextualization, Gap and Propose sub sections \
in an article.'),
                                QMessageBox.Ok)
Beispiel #54
0
    def writeToFile(self, filename):
        """ Save all contacts in the model to a file. """
        try:
            f = open(filename, "wb")
            pickle.dump(self.tableModel.addresses, f)

        except IOError:
            QMessageBox.information(self, "Unable to open file: %s" % filename)
        finally:
            f.close()
Beispiel #55
0
    def setProvider(self, providerId):
        self.serviceProvider = QGeoServiceProvider(providerId)
        if self.serviceProvider.error() != QGeoServiceProvider.NoError:
            QMessageBox.information(self, self.tr('MapViewer Example'),
                                    self.tr('Unable to dinf the %s geoservices plugin.' % providerId))

            qApp.quit()
            return

        self.mapManager = self.serviceProvider.mappingManager()
        self.routingManager = self.serviceProvider.routingManager()
Beispiel #56
0
	def addawordtodb(self):
		eng = self.dlg.lineEdit.text()
		tam = self.dlg.lineEdit_2.text()
		if len(eng) != 0 and len(tam) != 0:
			cur.execute("INSERT INTO ENGTAM(ENGW, TAMW) VALUES(?, ?)", (eng, tam, ))
			self.dlg.close()
			QMessageBox.information(self, "Nigandu Eng -> Tam Dictionary", "Added Successfully. . .")
		else:
			self.dlg.lineEdit.setFocus()
			self.dlg.close()
			QMessageBox.warning(self, "Nigandu Eng -> Tam Dictionary", "Invalid Entry. . .")
Beispiel #57
0
	def showdbHistoryResults(self, theResults):
		if theResults:
			print("theResults = " + str(theResults))
			modelHisDBRes = utilities.dbHistoryTableModel(theResults)
			self._theMainWindow.theHistory.theHistdbResults.tblViewHistoryDB.setModel(modelHisDBRes)
			self._theMainWindow.theHistory.theHistdbResults.tblViewHistoryDB.resizeColumnsToContents()
			self._theMainWindow.theHistory.theHistdbResults.show()
			self.thedbHistoryWorker.exit()
		else:
			QMessageBox.information(None, langmodule.noResults, langmodule.noUpdatesYes, 
								 QMessageBox.Ok | QMessageBox.Default, QMessageBox.NoButton)