def languageselector(self, parent=None): QtGui.QWidget.__init__(self, None) from langselectui import Ui_MainWindow self.ui = Ui_MainWindow() self.ui.setupUi(self) self.show() QtCore.QObject.connect(self.ui.pushButton, QtCore.SIGNAL("clicked()"), self.loadlanguage) clickable(self.ui.help).connect(self.webhelp) clickable(self.ui.checkupdatesBtn).connect(self.webupdate) clickable(self.ui.aboutBtn).connect(self.about) clickable(self.ui.translatenow).connect(self.translate) try: con = urllib.urlopen( "http://usbaktarici.googlecode.com/svn/trunk/version") data = con.read() con.close() if int(data) > version: self.onay = QtGui.QMessageBox.question( self, _fromUtf8('Warning'), _fromUtf8( "New version is available, do you want to download?"), QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, QtGui.QMessageBox.No) if self.onay == QtGui.QMessageBox.Yes: webbrowser.open("http://www.oguzkirat.com/usb-transfer") except: pass
def __init__(self, parent=None): super(UIPracticeWindow, self).__init__(parent) self.ui = Ui_MainWindow() self.ui.setupUi(self) # User functions self.ui.pushButton.clicked.connect(self.printDennts) self.ui.clear.clicked.connect(self.cleartext) self.ui.pushButton.clicked.connect(self.printMessage)
def createfromdvd(self): if self.img_src != "" and self.disk_dest != "": if osystem == 'win32': self.disk_size = int(self.driveliste[int(self.disk_dest)][4]) self.img_size = (int(self.b.drives[self.img_src]['size']) * (1024 * 1024)) elif osystem == 'linux2': self.disk_size = (int(self.a.drives[self.disk_dest]['size'])) self.img_size = (int(self.b.drives[self.img_src]['size'])) if osystem == "win32": simg = "\\\\.\\" + self.img_src else: simg = self.img_src global sourceimg sourceimg = simg global targetdisk targetdisk = self.disk_dest global size size = self.img_size / (1024**2) if self.img_size > self.disk_size: req_size = ((self.img_size - self.disk_size) / mbyte) self.warning_dialog( self.tr("Error!"), self.tr("There is no enough space on the target disk!") + "\n" + str(req_size) + self.tr("MBs more needed.")) else: self.onay = QtGui.QMessageBox.question( self, self.tr('Warning'), self. tr("You will lose all the data in the disk. Do you want to continue?" ), QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, QtGui.QMessageBox.No) if self.onay == QtGui.QMessageBox.Yes: from progressui import Ui_MainWindow self.hide() QtGui.QWidget.__init__(self, None) self.ui = Ui_MainWindow() self.ui.setupUi(self) self.show() if osystem == "win32": self.preparewin(targetdisk) self.ui.thread = CopyProgress() self.ui.thread.partDone.connect(self.updatePBar) self.ui.thread.procDone.connect(self.fin) self.ui.thread.start() else: self.warning_dialog(self.tr("Canceled!"), self.tr("Transfer canceled!")) else: self.warning_dialog( self.tr("Cannot continue."), self.tr("CD/DVD drive or target disk wasn't selected!")) return True
def __init__(self): super(MyApp, self).__init__() self.logfile = '' self.ui = Ui_MainWindow() self.ui.setupUi(self) # self.ui.setupUiExt(self) # self.ui.setupWidget(self) self.initialize() self._setup_signal() self.drvlog = None self.activesensor = 'accelerometer'
def __init__(self, parent=None): super(MainWindow, self).__init__(parent) self.main_frame = Ui_MainWindow() self.main_frame.setupUi(self) self.valueChanged = QtCore.Signal(int) timer = QtCore.QTimer(self) self.connect(timer, QtCore.SIGNAL("timeout()"), self.update) timer.start(speed)
def formatpage(self): self.disk_dest = "" from formatuiwin import Ui_MainWindow self.hide() QtGui.QWidget.__init__(self, None) self.ui = Ui_MainWindow() self.ui.setupUi(self) self.show() QtCore.QObject.connect(self.ui.selectUSBButton, QtCore.SIGNAL("clicked()"), self.select_disk) QtCore.QObject.connect(self.ui.Btn_Back, QtCore.SIGNAL("clicked()"), self.backtomain) QtCore.QObject.connect(self.ui.Btn_formatStart, QtCore.SIGNAL("clicked()"), self.formatting)
def __init__(self): super(Appwindow, self).__init__() self.ui = Ui_MainWindow() self.ui.setupUi(self) self.timer = QTimer() # self.timer.timeout.connect(self.tick) self.timer.timeout.connect(self.UDP_Srver) self.ui.btn_start_udp_server.clicked.connect(self.buttonClicked) self.ui.btn_stop_udp_server.clicked.connect(self.btn_stop) # self.timer.stop() pyqtgraph.setConfigOption('background', 'w') #before loading widget self.t = np.array([0]) self.x = np.array([0]) self.pocket_num = 0
def __init__(self): super(mywindow, self).__init__() self.con = psycopg2.connect(dbname=config.db_name, user=config.user, password=config.password, host=config.host) self.ui = Ui_MainWindow() self.ui.setupUi(self) self.ui.SignIn_btn.clicked.connect(self.signin) self.ui.SignUp_btn.clicked.connect(self.signup) self.error_dialog = QtWidgets.QMessageBox() self.error_dialog.setWindowTitle("Error") self.error_dialog.setStandardButtons(QMessageBox.Ok) self.info_dialog = QtWidgets.QMessageBox() self.info_dialog.setWindowTitle('INFO') self.info_dialog.setStandardButtons(QMessageBox.Ok)
def cddvd(self): self.disk_dest = "" from cddvdui import Ui_MainWindow self.hide() QtGui.QWidget.__init__(self, None) self.ui = Ui_MainWindow() self.ui.setupUi(self) self.show() QtCore.QObject.connect(self.ui.Btn_Back, QtCore.SIGNAL("clicked()"), self.backtomain) QtCore.QObject.connect(self.ui.selectDVDButton, QtCore.SIGNAL("clicked()"), self.select_dvd) QtCore.QObject.connect(self.ui.selectUSBButton, QtCore.SIGNAL("clicked()"), self.select_disk) QtCore.QObject.connect(self.ui.Btn_cddvdStart, QtCore.SIGNAL("clicked()"), self.createfromdvd) QtCore.QObject.connect(self.ui.Btn_download, QtCore.SIGNAL("clicked()"), self.downloaddist)
def backtomain(self): from mainui import Ui_MainWindow self.hide() QtGui.QWidget.__init__(self, None) self.ui = Ui_MainWindow() self.ui.setupUi(self) self.show() QtCore.QObject.connect(self.ui.Btn_cddvd, QtCore.SIGNAL("clicked()"), self.cddvd) QtCore.QObject.connect(self.ui.Btn_isoimg, QtCore.SIGNAL("clicked()"), self.isoimg) QtCore.QObject.connect(self.ui.Btn_format, QtCore.SIGNAL("clicked()"), self.formatpage) QtCore.QObject.connect(self.ui.Btn_download, QtCore.SIGNAL("clicked()"), self.downloaddist) self.selected = "" self.img_src = "" self.disk_dest = ""
def fin(self): from completedui import Ui_MainWindow self.hide() QtGui.QWidget.__init__(self, None) self.ui = Ui_MainWindow() self.ui.setupUi(self) self.show() if unicode(self.selected) != unicode(sourceimg): shutil.move(tempfile.gettempdir() + "\\temp.iso", unicode(self.selected)) try: isoname = unicode(self.selected).split("/")[-1].encode( 'ascii', 'ignore') webbrowser.open( "http://www.oguzkirat.com/apps/usbtransfer/completed.php?ver=" + str(version) + "&os=" + urllib.pathname2url(isoname)) except: pass
def createfromimage(self): try: str(self.selected) self.img_src = self.selected except: self.onay = QtGui.QMessageBox.question( self, self.tr('Warning'), self. tr("Selected file's path is containing special characters. To prevent problems, USBTransfer will move it to temporary directory and move it back. Click Yes if you want to move the file to temporary directory or click No to cancel the operation and change the path yourself.\nWhile moving program may seem unresponsive." ), QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, QtGui.QMessageBox.No) if self.onay == QtGui.QMessageBox.Yes: shutil.move(unicode(self.selected), tempfile.gettempdir() + "\\temp.iso") self.img_src = tempfile.gettempdir() + "\\temp.iso" else: self.img_src = "" if unicode(self.img_src) != "" and self.disk_dest != "": self.img_size = os.stat(self.img_src).st_size if osystem == 'win32': self.disk_size = int(self.driveliste[int(self.disk_dest)][4]) elif osystem == 'linux2': self.disk_size = (int(self.a.drives[self.disk_dest]['size']) * (1024 * 1024)) global sourceimg sourceimg = self.img_src global targetdisk targetdisk = self.disk_dest global size size = self.img_size / (1024**2) if self.img_size > self.disk_size: req_size = ((self.img_size - self.disk_size) / mbyte) self.warning_dialog( self.tr("Error!"), self.tr("There is no enough space on the target disk!") + "\n" + str(req_size) + self.tr("MBs more needed.")) else: self.onay = QtGui.QMessageBox.question( self, self.tr('Warning'), self. tr("You will lose all the data in the disk. Do you want to continue?" ), QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, QtGui.QMessageBox.No) if self.onay == QtGui.QMessageBox.Yes: from progressui import Ui_MainWindow self.hide() QtGui.QWidget.__init__(self, None) self.ui = Ui_MainWindow() self.ui.setupUi(self) self.show() if osystem == "win32": self.preparewin(targetdisk) self.ui.thread = CopyProgress() self.ui.thread.partDone.connect(self.updatePBar) self.ui.thread.procDone.connect(self.fin) self.ui.thread.start() else: self.warning_dialog(self.tr("Canceled"), self.tr("Transfer canceled!")) else: self.warning_dialog( self.tr("Cannot continue."), self.tr("ISO image or target disk wasn't selected!")) return True
def __init__(self, parent=None): super(ControlMainWindow, self).__init__(parent) self.ui = Ui_MainWindow() self.ui.setupUi(self) self.up_camera_signal.connect(self.updateImage)
head = ['Special Build Description', 'mean', 'median', 'std'] self.item_mean_std.setColumnCount(column) self.item_mean_std.setRowCount(row) self.item_mean_std.setHorizontalHeaderLabels(head) for i in range(0,row): for j in range(0, column): self.item_mean_std.setItem(i, j, QTableWidgetItem(str(temp_data.values[i][j]))) def hello(self): self.file_path.setText("hello world!") print("hello world") self.update_item_mean_std() app = QtWidgets.QApplication(sys.argv) #MainWindow = QMainWindow() window = Ui_MainWindow() window.show() sys.exit(app.exec_()) class mywindow(QtWidgets.QMainWindow, Ui_MainWindow): def __init__(self): super(mywindow, self).__init__() self.setupUi(self) def update_item_mean_std(self, temp_data, column, row): head = ['Special Build Description', 'mean', 'median', 'std'] self.item_mean_std.setColumnCount(column) self.item_mean_std.setRowCount(row) self.item_mean_std.setHorizontalHeaderLabels(head)