def interrogate_facility(self): """ Send the AT command to interrogate the currently selected facility. The result will be displayed in the terminal window. """ self.terminal.send_command('AT+CLCK="%s", 2' % self.get_facility()) def check_facility(self): """ Check which facility has been selected and disable any commands that are not available to the chosen facility. This method is triggered whenever a facility radio box is selected. """ # Enable the "enable" and "interrogate" buttons self.cb_enable_btn.setEnabled(True) self.cb_interrogate_btn.setEnabled(True) # Define a list of facilities that can only be disabled disable_only = ('AC', 'AG', 'AB') # Get the currently selected facility code & disable any necessary widgets if self.get_facility() in disable_only: self.cb_enable_btn.setDisabled(True) self.cb_interrogate_btn.setDisabled(True) if __name__ == '__main__': from standalone import run_standalone run_standalone(CallBarringWidget)
button_box.addWidget(self.level2_rad) button_box.addWidget(self.level3_rad) button_box.addWidget(self.level4_rad) button_box.addWidget(self.level5_rad) button_box.addWidget(self.level6_rad) button_box.addWidget(set_level_btn) button_gb.setLayout(button_box) # Create main layout container = QHBoxLayout() container.addStretch() container.addWidget(button_gb) container.addStretch() self.setLayout(container) # Connect widgets set_level_btn.clicked.connect(self.set_functionality) def set_functionality(self): if self.level0_rad.isChecked(): self.terminal.send_command('AT+CFUN=0') elif self.level1_rad.isChecked(): self.terminal.send_command('AT+CFUN=1') elif self.level2_rad.isChecked(): self.terminal.send_command('AT+CFUN=2') elif self.level3_rad.isChecked(): self.terminal.send_command('AT+CFUN=3') elif self.level4_rad.isChecked(): self.terminal.send_command('AT+CFUN=4') elif self.level5_rad.isChecked(): self.terminal.send_command('AT+CFUN=5') elif self.level6_rad.isChecked(): self.terminal.send_command('AT+CFUN=6') if __name__ == '__main__': from standalone import run_standalone run_standalone(SetFunctionalityWidget)
button_box.addWidget(self.level2_rad) button_box.addWidget(self.level3_rad) button_box.addWidget(self.level4_rad) button_box.addWidget(self.level5_rad) button_box.addWidget(self.level6_rad) button_box.addWidget(set_level_btn) button_gb.setLayout(button_box) # Create main layout container = QHBoxLayout() container.addStretch() container.addWidget(button_gb) container.addStretch() self.setLayout(container) # Connect widgets self.connect(set_level_btn, SIGNAL('clicked()'), self.set_functionality) def set_functionality(self): if self.level0_rad.isChecked(): self.terminal.send_command('AT+CFUN=0') elif self.level1_rad.isChecked(): self.terminal.send_command('AT+CFUN=1') elif self.level2_rad.isChecked(): self.terminal.send_command('AT+CFUN=2') elif self.level3_rad.isChecked(): self.terminal.send_command('AT+CFUN=3') elif self.level4_rad.isChecked(): self.terminal.send_command('AT+CFUN=4') elif self.level5_rad.isChecked(): self.terminal.send_command('AT+CFUN=5') elif self.level6_rad.isChecked(): self.terminal.send_command('AT+CFUN=6') if __name__ == '__main__': from standalone import run_standalone run_standalone(SetFunctionalityWidget)
old_network_pw = str(self.old_pw_txt.text()) new_network_pw = str(self.new_pw_txt.text()) # Validate the old network password try: self.validate_network_pw(old_network_pw) except ValueError as e: QMessageBox.critical(self, self.tr('Error'), self.tr(str(e)), QMessageBox.Ok) self.old_pw_txt.setFocus() self.old_pw_txt.selectAll() return # Validate the new network password try: self.validate_network_pw(new_network_pw) except ValueError as e: QMessageBox.critical(self, self.tr('Error'), self.tr(str(e)), QMessageBox.Ok) self.new_pw_txt.setFocus() self.new_pw_txt.selectAll() return # Create the change password command string command = 'AT+CPWD="%s", "%s", "%s"' % (facility, old_network_pw, new_network_pw) # Run the AT command in the terminal self.terminal.send_command(command) if __name__ == '__main__': from standalone import run_standalone run_standalone(ChangePasswordsWidget)
# Strip spaces and commas from both ends of the string dtmf_string = dtmf_string.strip(' ,') # Check each "item" is valid items = dtmf_string.split(',') for item in items: item = item.strip() if len(item) != 1: return 'The specified tone string is invalid, please check.' def send_string(self): dial_string = str(self.command_string.text()).strip(' ,') error_msg = self.validate_dtmf_string(dial_string) if error_msg: QMessageBox.critical(self, self.tr('Error'), self.tr(error_msg), QMessageBox.Ok) self.command_string.setFocus() self.command_string.selectAll() return items = [i.strip().upper() for i in dial_string.split(',')] self.terminal.send_command('AT+VTS="%s"' % ','.join(items)) if __name__ == '__main__': from standalone import run_standalone run_standalone(DtmfKeypadWidget)
button_box.addWidget(imei_btn) button_box.addWidget(imsi_btn) button_box.addWidget(manufacturer_btn) button_box.addWidget(model_btn) button_box.addWidget(software_btn) button_box.addWidget(modem_btn) button_box.addWidget(commands_btn) display_btns.setLayout(button_box) # Create main layout container = QHBoxLayout() container.addStretch() container.addWidget(display_btns) container.addStretch() self.setLayout(container) # Connect widgets imei_btn.clicked.connect(lambda: terminal.send_command('AT+CGSN')) imsi_btn.clicked.connect(lambda: terminal.send_command('AT+CIMI')) manufacturer_btn.clicked.connect( lambda: terminal.send_command('AT+GMI')) model_btn.clicked.connect(lambda: terminal.send_command('AT+GMM')) software_btn.clicked.connect(lambda: terminal.send_command('AT+GMR')) modem_btn.clicked.connect(lambda: terminal.send_command('AT+GCAP')) commands_btn.clicked.connect(lambda: terminal.send_command('AT+CLAC')) if __name__ == '__main__': from standalone import run_standalone run_standalone(BasicInfoWidget)
if char_upper and char_upper not in allowed_chars: return 'Character "%s" is invalid.' % char_original # Strip spaces and commas from both ends of the string dtmf_string = dtmf_string.strip(' ,') # Check each "item" is valid items = dtmf_string.split(',') for item in items: item = item.strip() if len(item) != 1: return 'The specified tone string is invalid, please check.' def send_string(self): dial_string = str(self.command_string.text()).strip(' ,') error_msg = self.validate_dtmf_string(dial_string) if error_msg: QMessageBox.critical(self, self.tr('Error'), self.tr(error_msg), QMessageBox.Ok) self.command_string.setFocus() self.command_string.selectAll() return items = [i.strip().upper() for i in dial_string.split(',')] self.terminal.send_command('AT+VTS="%s"' % ','.join(items)) if __name__ == '__main__': from standalone import run_standalone run_standalone(DtmfKeypadWidget)
container = QHBoxLayout() container.addStretch() container.addLayout(main_layout) container.addStretch() self.setLayout(container) # Connect widgets make_call_btn.clicked.connect(self.make_call) answer_call_btn.clicked.connect(lambda: terminal.send_command('ATA')) end_call_btn.clicked.connect(lambda: terminal.send_command('ATH')) def make_call(self): """ Sends the AT command to initiate a voice or data call. """ dial_string = str(self.call_string_txt.text()).strip() if dial_string: QMessageBox.critical(self, self.tr('Error'), self.tr('Please enter a string to dial'), QMessageBox.Ok) return command_string = 'ATD%s;' if self.voice_call_rad.isChecked( ) else 'ATD%s' self.terminal.send_command(command_string % dial_string) if __name__ == '__main__': from standalone import run_standalone run_standalone(CallControlWidget)
display_btns = QGroupBox(self.tr('Display Information:')) button_box = QVBoxLayout() button_box.addWidget(imei_btn) button_box.addWidget(imsi_btn) button_box.addWidget(manufacturer_btn) button_box.addWidget(model_btn) button_box.addWidget(software_btn) button_box.addWidget(modem_btn) button_box.addWidget(commands_btn) display_btns.setLayout(button_box) # Create main layout container = QHBoxLayout() container.addStretch() container.addWidget(display_btns) container.addStretch() self.setLayout(container) # Connect widgets self.connect(imei_btn, SIGNAL('clicked()'), lambda: terminal.send_command('AT+CGSN')) self.connect(imsi_btn, SIGNAL('clicked()'), lambda: terminal.send_command('AT+CIMI')) self.connect(manufacturer_btn, SIGNAL('clicked()'), lambda: terminal.send_command('AT+GMI')) self.connect(model_btn, SIGNAL('clicked()'), lambda: terminal.send_command('AT+GMM')) self.connect(software_btn, SIGNAL('clicked()'), lambda: terminal.send_command('AT+GMR')) self.connect(modem_btn, SIGNAL('clicked()'), lambda: terminal.send_command('AT+GCAP')) self.connect(commands_btn, SIGNAL('clicked()'), lambda: terminal.send_command('AT+CLAC')) if __name__ == '__main__': from standalone import run_standalone run_standalone(BasicInfoWidget)
self.dbc.close() connection = self.dbc.connectionName() rmcon = QSqlDatabase().removeDatabase(connection) self.server.setEnabled(True) self.db.setEnabled(True) self.username.setEnabled(True) self.password.setEnabled(True) self.con_btn.setEnabled(True) self.dis_tton.setEnabled(False) def showdialog(slef, text): msg = QMessageBox() msg.setIcon(QMessageBox.Information) msg.setText(text) msg.setWindowTitle("Database Coonect") msg.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel) retval = msg.exec_() print "value of pressed message box button:", retval def insert(self, qry): if (self.dbc.open()): qr = QSqlQuery() print "Print Query : " + qry print qr.exec_(qry) if __name__ == '__main__': from standalone import run_standalone run_standalone(MysqlcoonectWidget)
old_network_pw = str(self.old_pw_txt.text()) new_network_pw = str(self.new_pw_txt.text()) # Validate the old network password try: self.validate_network_pw(old_network_pw) except ValueError, e: QMessageBox.critical(self, self.tr('Error'), self.tr(e.message), QMessageBox.Ok) self.old_pw_txt.setFocus() self.old_pw_txt.selectAll() return # Validate the new network password try: self.validate_network_pw(new_network_pw) except ValueError, e: QMessageBox.critical(self, self.tr('Error'), self.tr(e.message), QMessageBox.Ok) self.new_pw_txt.setFocus() self.new_pw_txt.selectAll() return # Create the change password command string command = 'AT+CPWD="%s", "%s", "%s"' % (facility, old_network_pw, new_network_pw) # Run the AT command in the terminal self.terminal.send_command(command) if __name__ == '__main__': from standalone import run_standalone run_standalone(ChangePasswordsWidget)
itemadd.setText("No HP") itemadd = self.tableWidget.horizontalHeaderItem(1) itemadd.setText( "Tgl") itemadd = self.tableWidget.horizontalHeaderItem(2) itemadd.setText("Jam") itemadd = self.tableWidget.horizontalHeaderItem(3) itemadd.setText("Pesan") #creat grid layout veticalbox = QVBoxLayout() veticalbox.addWidget(self.tableWidget) # Create main layout container = QHBoxLayout() container.addLayout(veticalbox) self.setLayout(container) #self.additemRow('+62876767862','17/02/28' , '15:47:58+28' , 'testing testing testing') def additemRow(self , nohp , tgl , jam , pesan): rowPosition = self.tableWidget.rowCount() #print str(rowPosition)+ " , " + str(nohp) +" , "+ tgl +" , "+ jam +" , "+ pesan self.tableWidget.insertRow(rowPosition) self.tableWidget.setItem(rowPosition , 0, QTableWidgetItem(str(nohp))) self.tableWidget.setItem(rowPosition , 1, QTableWidgetItem(str(tgl))) self.tableWidget.setItem(rowPosition , 2, QTableWidgetItem(str(jam))) self.tableWidget.setItem(rowPosition , 3, QTableWidgetItem(str(pesan).encode('ascii', 'ignore'))) if __name__ == '__main__': from standalone import run_standalone run_standalone(LogsmsWidget)