Ejemplo n.º 1
0
class App(QtGui.QMainWindow):
    def __init__(self):
        QtGui.QMainWindow.__init__(self)

        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        self.ui.connect_button.clicked.connect(self.start)
        self.ui.send_button.clicked.connect(self.send_msg)

        self.client = None

    def start(self):
        server = self.ui.server_text.text()
        username = self.ui.user_text.text()


        self.client = Client(username, server)
        self.client.new_message.connect(self.print_msg)

        self.ui.chat_text.setEnabled(True)
        self.ui.message_text.setEnabled(True)
        self.ui.send_button.setEnabled(True)

    def send_msg(self):
        message = self.ui.message_text.text()
        self.ui.message_text.clear()
        self.client.send(message)

    def print_msg(self, message):
        self.ui.chat_text.append(message)
Ejemplo n.º 2
0
class MyWindow(QtWidgets.QMainWindow):
    def __init__(self):
        super().__init__()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        # Меняет размер всех колонок.
        self.ui.tableWidget.horizontalHeader().setSectionResizeMode(3)
        # self.ui.tableWidget.horizontalHeader().setMinimumSectionSize(1)
        self.machines = []

        row = 0
        for i in self.machines:
            a = QtWidgets.QTableWidgetItem()
            a.setData(Qt.DisplayRole, i)
            self.ui.tableWidget.setItem(row, 0, a)
            a = QtWidgets.QTableWidgetItem()
            a.setData(10, 2)
            self.ui.tableWidget.setItem(row, 1, a)
            a = QtWidgets.QTableWidgetItem()
            a.setData(Qt.DisplayRole, 'free')
            self.ui.tableWidget.setItem(row, 2, a)
            row += 1

    def main_logic(self):
        client = Client()
        self.machines = client.machine_list
        client.set_up('localhost', 5001)
        client.start()
Ejemplo n.º 3
0
    def __init__(self):
        app = QtWidgets.QApplication(sys.argv)

        MainWindow = QtWidgets.QMainWindow()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(MainWindow)
        #--------------------------
        self.ui.comboBox.hide()
        self.drop_combo = DragDropCombo(MainWindow)
        self.drop_combo.setMinimumSize(QtCore.QSize(141, 0))
        self.ui.horizontalLayout.addWidget(self.drop_combo)

        #--------------------------
        self.ui.pushButton.hide()
        #         self.ui.pushButton.setParent(None)  # deleting parent deletes the button
        self.drop_button = DragDropButton('DropButton', MainWindow)
        self.drop_button.setMinimumSize(QtCore.QSize(150, 0))
        self.ui.horizontalLayout.addWidget(self.drop_button)

        #--------------------------
        self.update_tree()
        self.update_calendar()
        self.update_progressbar()

        MainWindow.show()
        sys.exit(app.exec_())
Ejemplo n.º 4
0
class HesapMakinesi(QtWidgets.QMainWindow):
    def __init__(self):
        super(HesapMakinesi, self).__init__()
        #Buton tıklama işlemleri yapılacak olan kodlar ve arayüz.

        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.ui.btn_topla.clicked.connect(self.toplama)
        self.ui.btn_cikarma.clicked.connect(self.cikarma)
        self.ui.btn_carpma.clicked.connect(self.carpma)
        self.ui.btn_bolme.clicked.connect(self.bolme)

    def toplama(self):
        result = int(self.ui.txt_sayi1.text()) + int(
            self.ui.txt_sayi2.text())  # toplama işlmeminin yapıldığı dizin
        self.ui.lbl_sonuc.setText('sonuç: ' + str(result))

    def cikarma(self):
        result = int(self.ui.txt_sayi1.text()) - int(
            self.ui.txt_sayi2.text())  # çıkarma işlemini yaptığım dizin
        self.ui.lbl_sonuc.setText('sonuç :' + str(result))

    def bolme(self):
        result = int(self.ui.txt_sayi1.text()) / int(
            self.ui.txt_sayi2.text())  # bölme işlemi lokasyonu
        self.ui.lbl_sonuc.setText('sonuç : ' + str(result))

    def carpma(self):
        result = int(self.ui.txt_sayi1.text()) * int(
            self.ui.txt_sayi2.text())  # çarpma işlemi yapılan dizin
        self.ui.lbl_sonuc.setText('sonuç : ' + str(result))
Ejemplo n.º 5
0
    def __init__(self):
        QtWidgets.QMainWindow.__init__(self)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        # Everything in the chucks below is connecting functions to widgets / buttons in Qt

        self.ui.push_connect.clicked.connect(dorna_connect)
        self.ui.push_home.clicked.connect(dorna_home)
        self.ui.push_zeros.clicked.connect(dorna_zeros)
        self.ui.push_calibrate.clicked.connect(self.calibrate)
        self.ui.push_reset.clicked.connect(dorna_reset)
        self.ui.push_disconnect.clicked.connect(dorna_disconnect)

        self.ui.j0_absolute_push.clicked.connect(self.j0_absolute)
        self.ui.j1_absolute_push.clicked.connect(self.j1_absolute)
        self.ui.j2_absolute_push.clicked.connect(self.j2_absolute)
        self.ui.j3_absolute_push.clicked.connect(self.j3_absolute)
        self.ui.j4_absolute_push.clicked.connect(self.j4_absolute)

        self.ui.j0_relative_push.clicked.connect(self.j0_relative)
        self.ui.j1_relative_push.clicked.connect(self.j1_relative)
        self.ui.j2_relative_push.clicked.connect(self.j2_relative)
        self.ui.j3_relative_push.clicked.connect(self.j3_relative)
        self.ui.j4_relative_push.clicked.connect(self.j4_relative)
Ejemplo n.º 6
0
 def __init__(self, onj=None, *args, **kwargs):
     super(MainWindow, self).__init__(*args, **kwargs)
     self.ui = Ui_MainWindow()
     self.ui.setupUi(self)
     self.messageController = MessageController()
     self.simSettings = SimulatorSettings()
     self.sim = Simulator(self.simSettings, self.messageController)
     self.con = Controller(self.simSettings, self.sim.hospitalsLocations(),
                           self.sim.ambulancesDistribution(),
                           self.messageController)
     self.ui.Mplwidget
     self.ui.Mplwidget.draw_hospital_on_map(self.con.Hospitals)
     self.ui.hospwidget
     self.ui.hospwidget.draw_all_hosp_inf(self.con.Hospitals)
     self.tablica_komunikatow = []
     self.control_events = []
     self.observ_from_message = []
     self.ui.start.clicked.connect(self.start_sim)
     self.ui.pauza.clicked.connect(self.stop_sim)
     self.ui.reset.clicked.connect(self.reset_sim)
     self.ui.delay_time.setValue(50)
     self.ui.delay_time.valueChanged.connect(self.change_interval)
     self.timer = QtCore.QTimer(self,
                                interval=self.ui.delay_time.value(),
                                timeout=self.simulation)
     self.printedCar = []
     self.printedVirus = []
     self.iterationsNumber = 0
Ejemplo n.º 7
0
class MyApp(QtWidgets.QMainWindow):
    def __init__(self):
        super(MyApp,self).__init__()
        # herhangi bir text label butona ulaşmak istediğimizde artık self.ui ile ulaşacağız (self.ui.txt_sayi2) gibi
        self.ui=Ui_MainWindow()
        self.ui.setupUi(self) # app projemize designerdaki elemanlar aktarılsın

        # click atamalarını burada yapıyoruz
        self.ui.btn_topla.clicked.connect(self.hesapla)
        self.ui.btn_cikarma.clicked.connect(self.hesapla)
        self.ui.btn_bolme.clicked.connect(self.hesapla)
        self.ui.btn_carpma.clicked.connect(self.hesapla)
    def hesapla(self):
        sender=self.sender().text()
        print(sender)
        result=0
        if sender=="Toplam":
            result=int(self.ui.txt_sayi1.text()) + int(self.ui.txt_sayi2.text())
        elif sender=='Çıkarma':
            result=int(self.ui.txt_sayi1.text()) - int(self.ui.txt_sayi2.text())
        elif sender=="Çarpma":
            result=int(self.ui.txt_sayi1.text()) * int(self.ui.txt_sayi2.text())
        elif sender=="Bölme":
            result=int(self.ui.txt_sayi1.text()) / int(self.ui.txt_sayi2.text())
        self.ui.lbl_sonuc.setText("Sonuc: "+str(result)) 
Ejemplo n.º 8
0
class MainWindow(QMainWindow):
    def __init__(self):
        QMainWindow.__init__(self)
        self.window = Ui_MainWindow()
        self.window.setupUi(self)
        self.show()
        ####################################

        self.Tracker_Window = TrackerWindow()

        ####################################
        self.window.AccesButton.clicked.connect(self.show_tracker_window)
        self.window.helpButton.installEventFilter(self)

    def show_tracker_window(self):
        if len(self.window.emailText.text()) == 0:
            QMessageBox.about(self, "eMag Price Tracker",
                              "Please enter a valid email address!")
        else:
            self.hide()
            self.Tracker_Window.email = self.window.emailText.text()
            self.Tracker_Window.show()

    def eventFilter(self, object, event):
        if object == self.window.helpButton and event.type(
        ) == QtCore.QEvent.HoverEnter:
            QMessageBox.about(
                self, "eMag Price Tracker",
                "Enter your valid email and start tracking. Add links for your products, create a preset, load it, and start tracking!"
            )
        return False
Ejemplo n.º 9
0
    def setupUI(self):
        """setup UI"""
        logger.info(f"Loaded UI..")
        self._ui = Ui_MainWindow()
        self._ui.setupUi(self)
        self.setWindowTitle("Dr. Tensorflow Facial Points Detector")
        self._capture_widget = QtCapture(mainwindow=self,
                                         model_name=DEFAULT_MODEL_FILE)
        self._ui.verticalLayout.addChildWidget(self._capture_widget)
        self.setFixedSize(DEFAULT_MAIN_WINDOW_WIDTH,
                          DEFAULT_MAIN_WINDOW_HEIGHT)
        self._ui.textEdit_filename.setText(
            os.path.join(os.getcwd(), DEFAULT_MODEL_FILE))
        self._ui.menubar.setVisible(True)

        # link events
        self._ui.pushButton_StartCapture.clicked.connect(
            self._capture_widget.start)
        self._ui.pushButton_StopCapture.clicked.connect(
            self._capture_widget.stop)
        self._ui.checkBox_glasses.stateChanged.connect(
            self._capture_widget.setGlassesState)
        self._ui.checkBox_cigarette.stateChanged.connect(
            self._capture_widget.setCigaretteState)
        self._ui.checkBox_n95mask.stateChanged.connect(
            self._capture_widget.setN95maskState)
        self._ui.checkBox_fps.stateChanged.connect(
            self._capture_widget.setPointState)
        self._ui.menu_File.triggered.connect(self.closeEvent)
        self._ui.menu_About.triggered.connect(self.showAboutDialog)
        self._ui.pushButton_browse.clicked.connect(self.browseModel)

        # initial state
        self._ui.checkBox_fps.setChecked(True)
Ejemplo n.º 10
0
class myApp(QtWidgets.QMainWindow):

    def __init__(self):
        super(myApp, self).__init__()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        self.ui.btn_topla.clicked.connect(self.hesapla)
        self.ui.btn_cikarma.clicked.connect(self.hesapla)
        self.ui.btn_carpma.clicked.connect(self.hesapla)
        self.ui.btn_bolme.clicked.connect(self.hesapla)

    def hesapla(self):
        sender = self.sender().text()
        result = 0

        if sender == 'Toplam':
            result = int(self.ui.txt_sayi1.text()) + int(self.ui.txt_sayi2.text())
        elif sender == 'Cikarma':
            result = int(self.ui.txt_sayi1.text()) - int(self.ui.txt_sayi2.text())
        elif sender == 'Carpma':
            result = int(self.ui.txt_sayi1.text()) * int(self.ui.txt_sayi2.text())
        elif sender == 'Bolme':
            result = int(self.ui.txt_sayi1.text()) / int(self.ui.txt_sayi2.text())

        self.ui.lbl_sonuc.setText('sonuç: '+ str(result))
Ejemplo n.º 11
0
    def __init__(self):
        QMainWindow.__init__(self)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        ''' Toggle menu '''
        #self.ui.btn_toggle.clicked.connect(lambda: UIFunctions.toggleMenu(self, 150, True))

        #Pages

        # PAGE 1
        self.ui.Btn_about.clicked.connect(
            lambda: self.ui.stackedWidget.setCurrentWidget(self.ui.
                                                           stackedWidgetPage1))

        # PAGE 2
        self.ui.Btn_emotion.clicked.connect(
            lambda: self.ui.stackedWidget.setCurrentWidget(self.ui.
                                                           stackedWidgetPage2))

        # PAGE 3
        #self.ui.Btn_capture.clicked.connect(lambda: self.ui.stackedWidget.setCurrentWidget(self.ui.stackedWidgetPage3))

        self.ui.Btn_capture.clicked.connect(lambda: self.showSave())

        #FOR VIDEO
        # create a timer
        self.timer = QTimer()
        # set timer timeout callback function
        self.timer.timeout.connect(self.viewCam)
        # set control_bt callback clicked  function
        self.ui.Btn_emotion.clicked.connect(self.controlTimer)

        #self.ui.Btn_capture.clicked.connect(self.controlTimer)
        '''
Ejemplo n.º 12
0
 def __init__(self):
     super().__init__()
     self.UI = Ui_MainWindow()
     self.setupUI()
     self.setWindowIcon(QtGui.QIcon("Icon/icon_app.png"))
     screen = QtWidgets.QDesktopWidget().screenGeometry()
     self.setGeometry(0,0,screen.width(), screen.height())
Ejemplo n.º 13
0
    def setupUI(self):
        """setup UI"""
        logging.info(f"Loading UI..")
        self._ui = Ui_MainWindow()
        self._ui.setupUi(self, widthMult=self.widthMult)

        self.setWindowTitle("Mask Detector")
        self.populateCombobox()
        self._capture_widget = QtCapture(
            mainwindow=self, mask_model=self._ui.comboBox_model.currentText())
        self._ui.verticalLayout.addChildWidget(self._capture_widget)
        self.setFixedSize(DEFAULT_MAIN_WINDOW_WIDTH * self.widthMult,
                          DEFAULT_MAIN_WINDOW_HEIGHT)
        self._ui.menubar.setVisible(True)

        # link events
        self._ui.pushButton_StartCapture.clicked.connect(
            self._capture_widget.start)
        self._ui.pushButton_StopCapture.clicked.connect(
            self._capture_widget.stop)
        # self._ui.pushButton_StartMqtt.clicked.connect(self._capture_widget.startMqtt)
        # self._ui.pushButton_StopMqtt.clicked.connect(self._capture_widget.stopMqtt)
        self._ui.comboBox_model.currentTextChanged.connect(
            self._capture_widget.updateModel)

        self._ui.checkBox_Mqtt.stateChanged.connect(self.toggleMqtt)
        # self._ui.checkBox_Stereo.stateChanged.connect(self.toggleStereo)

        self._ui.menu_File.triggered.connect(self.closeEvent)
        self._ui.menu_About.triggered.connect(self.showAboutDialog)
        self._ui.pushButton_update.clicked.connect(self.updateModel)
Ejemplo n.º 14
0
    def __init__(self, mainwindow):
        Ui_MainWindow.__init__(self)
        self.setupUi(mainwindow)

        self.msgbox = QMessageBox()
        self.msgbox.setIcon(QMessageBox.Critical)
        self.msgbox.setWindowTitle("ERROR")
        self.msgbox.setStandardButtons(QMessageBox.Ok)
        self.msgbox.setDefaultButton(QMessageBox.Ok)

        self.R = 82.1  #Ideal Gas Constant (mL atm / k mol)

        self.constants = shelve.open('Constants')
        self.calibrationslope_Edit.setText(
            str(self.constants['Calibration Slope']))
        self.flowrate_Edit.setText(str(self.constants['Flow Rate']))
        self.temperature_Edit.setText(str(self.constants['Temperature']))
        self.constants.close()

        #Data Required For Formatting
        self.__gcdataframe = None
        self.__potentiostat_TotalSeconds = None
        self.__calibration_slope = None
        self.__flow_rate = None
        self.__temperature = None
        self.__baseline = None
        self.__export_filename = None
        self.__potentiostat_start_timestamp = None
        self.__gc_timestamp = None
        #

        self.GCFile_button.clicked.connect(self.openGC)
        self.Format_button.clicked.connect(self.formatData)
        self.PotentiostatFile_button.clicked.connect(self.openPotentiostat)
Ejemplo n.º 15
0
class CalcApp(QtWidgets.QMainWindow):
    def __init__(self):
        super(CalcApp, self).__init__()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.ui.btn_equal.clicked.connect(self.showCountResult)
        self.ui.btn_ce.clicked.connect(self.clear)
        self.ui.text_line.textChanged.connect(self.textChanged)
        self.showClickResult()

    def showClickResult(self):
        regExp = QtCore.QRegExp("btn_([0-9])|(add)|(sub)|(mul)|(div)")
        buttons = self.ui.centralwidget.findChildren(QtWidgets.QPushButton,
                                                     regExp)
        for i in buttons:
            i.clicked.connect(self.btnInput)

    def showCountResult(self):
        self.ui.text_line.setText(countMethods.count(self.ui.text_line.text()))

    def clear(self):
        self.ui.text_line.clear()
        self.ui.text_line.setFocus()

    def btnInput(self):
        text = self.ui.text_line.text() + self.sender().text()
        self.ui.text_line.setText(text)

    def keyPressEvent(self, event):
        if event.key() in [QtCore.Qt.Key_Equal, QtCore.Qt.Key_Enter]:
            self.showCountResult()

    def textChanged(self):
        self.ui.text_line.setText(methods.verifyText(self.ui.text_line.text()))
Ejemplo n.º 16
0
    def __init__(self, parent=None):
        QtWidgets.QWidget.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.DoseDiffs = []
        self.CurDir = os.getcwd()
        self.PlanDCMPath = ''
        #Remove old report image everytime
        try:
            os.remove('Report.tiff')
            os.remove('Report.pdf')
        except:
            pass

        self.TxInfo = {}
        self.TxInfo['PatientID'] = ''
        self.TxInfo['PatientName'] = ''
        self.TxInfo['LinacID'] = ''
        self.TxInfo['MeasuredBy'] = ''
        self.TxInfo['MeasuredOn'] = ''
        self.TxInfo['Technique'] = ''
        self.TxInfo['Site'] = ''

        #True by default, i.e.,runs batch files to parse and transfer new files each time "Analyse" is clicked
        self.RestartSesssion = True
        self.ui.statusbar.showMessage("Click Analyse to start.")
        self.ui.textEditInfo.append(
            "--------------------------------------FluDoPy------------------------------------------------------------------------"
        )
        self.ui.pushButtonAnalyse.clicked.connect(self.Analyse)
        self.ui.pushButtonDB.clicked.connect(self.pushResultsToDB)
        self.PowerShellPath = os.getcwd() + '\\' + 'CopyDynasFluDoPy.ps'
 def __init__(self):
     super(Frequency, self).__init__()
     self.ui = Ui_MainWindow()
     self.ui.setupUi(self)
     self.ui.pushButton_histograms_load_2.clicked.connect(self.button_clicked1)##LOAD IMAGE 1 HYBRID
     self.ui.pushButton_histograms_load_3.clicked.connect(self.button_clicked2)##LOAD IMAGE 2 HYBRID
     self.ui.pushButton_histograms_load_4.clicked.connect(self.button_clicked3)##OUTPUT HYBRID
Ejemplo n.º 18
0
    def __init__(self):
        super().__init__()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)        
        centralWidget = QWidget()
        #centralWidget.resize(200,300)			
        layout = QVBoxLayout()		
        hbox = QHBoxLayout()
        hbox.addLayout(layout)
        #hbox.addStretch(1)
        anotherwidget = CategoryNewWindow()
        hbox.addWidget(anotherwidget)
        centralWidget.setLayout(hbox)
        self.setCentralWidget(centralWidget)
        sql = 'SELECT *FROM Categories LIMIT 0,2'
        result = conn.execute(sql)
        i=20;
        for row in result:
         l = LinkLabel()
         l.linkId=row[0]
         l.setText(row[1])
         l.setGeometry(QtCore.QRect(150, i, 200, 20))
         anotherwidget.make_connection(l)
         i=i+20
         layout.addWidget(l)
		
        self.show()
Ejemplo n.º 19
0
    def setupUi(self, MainWindow, pat):
        Ui_MainWindow.setupUi(self, MainWindow)
        #print(Mediator.showRecord(op_no))
        self.mainwindow = MainWindow
        self.patient = pat
        (op_no, name, weight, height, pulse, bp, occu, ph_no, sex, age, place,
         hos) = self.patient.show()
        self.op_no.setReadOnly(True)
        self.op_no.setText(op_no)

        self.name.setReadOnly(True)
        self.name.setText(name)

        self.age.setReadOnly(True)
        self.age.setText(age)
        self.sex.setReadOnly(True)
        self.sex.setText(sex)
        self.place.setReadOnly(True)
        self.place.setText(place)
        self.ph_no.setReadOnly(True)
        self.ph_no.setText(ph_no)

        self.weight.setReadOnly(True)
        self.weight.setText(weight)
        self.pulse.setReadOnly(True)
        self.pulse.setText(pulse)
        self.bp.setReadOnly(True)
        self.bp.setText(bp)
        self.height.setReadOnly(True)
        self.height.setText(height)
        self.occu.setReadOnly(True)
        self.occu.setText(occu)
        self.hos.setReadOnly(True)
        self.hos.setText(hos)
        self.nextButton.clicked.connect(self.nextWindow)
Ejemplo n.º 20
0
class MyApp(QtWidgets.QMainWindow):
    def __init__(self):
        super(MyApp, self).__init__()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.ui.btnAdd.clicked.connect(self.Result)
        self.ui.BtnSubstract .clicked.connect(self.Result)
        self.ui.BtnDivide.clicked.connect(self.Result)
        self.ui.btnMultiply.clicked.connect(self.Result)


    def Result(self):
        sender = self.sender()
        result = 00
        if sender.text() == "+":
            result = int(self.ui.txt1.text()) + int(self.ui.txt2.text())
        
        elif sender.text() == "-":
            result = int(self.ui.txt1.text()) - int(self.ui.txt2.text())
        
        elif sender.text() == "*":
            result = int(self.ui.txt1.text()) / int(self.ui.txt2.text())
        
        elif sender.text() == "/":
            result = int(self.ui.txt1.text()) * int(self.ui.txt2.text())

        self.ui.lblResult.setText("Result: "+ str(result))
Ejemplo n.º 21
0
    def __init__(self):
        app = QtWidgets.QApplication(sys.argv)
        
        self.MainWindow = QtWidgets.QMainWindow()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self.MainWindow)   
        #-------------------------- 
        
        self.ui.button_stop_animation.clicked.connect(self.stop_animation)
        self.ui.button_start_animation.clicked.connect(self.animate)

        self.ui.toolButton.hide()
#         self.toolButton = QtWidgets.QToolButton(self.tab_animation)
#         self.move_toolbutton.setObjectName("toolButton")
        self.move_toolbutton = MoveToolButton(self.ui.tab_animation)
        self.move_toolbutton.setGeometry(QtCore.QRect(330, 20, 25, 19))
        self.move_toolbutton.setAutoFillBackground(True)
        self.move_toolbutton.setText("***")
        


        #-------------------------- 
        self.init_tabs()
        
        self.MainWindow.show()
        sys.exit(app.exec_()) 
Ejemplo n.º 22
0
class MyApp(QtWidgets.QMainWindow):
    def __init__(self):
        super(MyApp, self).__init__()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.ui.btn_toplama.clicked.connect(self.hesapla)
        self.ui.btn_cikarma.clicked.connect(self.hesapla)
        self.ui.btn_carmpa.clicked.connect(self.hesapla)
        self.ui.btn_bolma.clicked.connect(self.hesapla)

    def hesapla(self):
        sender = self.sender().text()
        result = 0
        if sender == "Toplama":
            result = int(self.ui.txt_sayi1.text()) + int(
                self.ui.txt_sayi2.text())
        elif sender == "Çıkarma":
            result = int(self.ui.txt_sayi1.text()) - int(
                self.ui.txt_sayi2.text())
        elif sender == "Çarpma":
            result = int(self.ui.txt_sayi1.text()) * int(
                self.ui.txt_sayi2.text())
        elif sender == "Bölme":
            result = int(self.ui.txt_sayi1.text()) / int(
                self.ui.txt_sayi2.text())

        self.ui.lbl_sonuc.setText("Sonuç:  " + str(result))
Ejemplo n.º 23
0
    def __init__(self):
        QtWidgets.QMainWindow.__init__(self)
        Ui_MainWindow.__init__(self)
        self.setupUi(self)
        self.boton3.setEnabled(False)
        self.boton4.setEnabled(False)
        self.boton5.setEnabled(False)


        self.progressBar.setValue(0)
        self.umbral.setValue(0.0)
        self.totalEntrenamiento.setText('0')
        self.totalPrueba.setText('0')


        self.conjEntrenamiento.setMaximum(100.0)
        self.conjEntrenamiento.setMinimum(0.0)
        self.conjEntrenamiento.setValue(100.0)

        self.eficiencia.setText('')


        #Acá van los botones
        self.boton1.clicked.connect(self.getCSV)
        self.boton2.clicked.connect(self.algoritmoPrincipal)
        self.boton3.clicked.connect(self.showTree)
        self.boton4.clicked.connect(self.showPlot)
        self.boton5.clicked.connect(self.guardarPlano)
        self.buttonCargar.clicked.connect(self.cargarDatos)
Ejemplo n.º 24
0
class notifyerForm(QtGui.QMainWindow):
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self,parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self
        connect(self.ui.pushButtonStart, QtCore.SIGNAL("clicked()"), self.startuj)	


    def startuj(self):   
    	pageAddress = self.ui.lineEditAddressil.text
   		destinEmail = self.ui.lineEditDestinationEmail.text
   		passwordEmail = self.ui.lineEditPassword.text
   		loginEmail = self.lineEditPassword.text
   		message = pageAddress+" zmienila sie tresc! Pzdr"

   		watcher(pageAddress, destinEmail, message, loginEmail, passwordEmail )
   		sys.exit()	


if __name__ == "__main__":
    app = QtGui.QApplication(sys.argv)
    myapp = notifyerForm()
    myapp.show()
    sys.exit(app.exec())
    
Ejemplo n.º 25
0
 def __init__(self):
     super(MainWindow, self).__init__()
     self.ui = Ui_MainWindow()
     self._datapath, self._wtype = self.__load_setting()
     self.ui.setupUi(self)
     self.ui.tableView.setSelectionBehavior(QAbstractItemView.SelectRows)
     self.setWindowTitle("天气形式数据删选")
     self.setWindowIcon(QIcon('./source/icon.png'))
     self._data = pd.DataFrame()
     self._model = PandasModel(self._data)
     self._types = []
     self.load()
     # 右键菜单
     self.setContextMenuPolicy(Qt.CustomContextMenu)
     self.customContextMenuRequested.connect(self.show_menu)
     self.CustomContextMenu = QMenu(self)
     # 创建选项
     self.action_draw = self.CustomContextMenu.addAction("绘图")
     self.action_reset = self.CustomContextMenu.addAction("重置")
     self.action_draw.triggered.connect(self.draw_callback)
     self.action_reset.triggered.connect(self.reset)
     # 信号槽
     self.ui.cmb_type.activated.connect(self.type_callback)
     self.ui.cmb_year.activated.connect(self.year_callback)
     self.ui.cmb_month.activated.connect(self.month_callback)
     self.ui.cmb_day.activated.connect(self.day_callback)
     self.ui.button_draw.clicked.connect(self.draw_callback)
Ejemplo n.º 26
0
class MyMainW(QtGui.QMainWindow):
    DB = None
    def __init__(self, db,parent=None):
        MyMainW.DB=db
        QtGui.QMainWindow.__init__(self,parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.ui.lineEdit.setText(time.strftime('%Y-%m-%d ',time.localtime(time.time())))
        str="Welcome! Happy Every Day!"
        self.ui.textEdit.setText(str)
                
        QtCore.QObject.connect(self.ui.action_2,QtCore.SIGNAL("triggered()"),self.openBookInfo)
        QtCore.QObject.connect(self.ui.action_3,QtCore.SIGNAL("triggered()"),self.openSupplierInfo)
        QtCore.QObject.connect(self.ui.action_4,QtCore.SIGNAL("triggered()"),self.openCusInfo)
        QtCore.QObject.connect(self.ui.action_5,QtCore.SIGNAL("triggered()"),self.openAddBookInfo)
        QtCore.QObject.connect(self.ui.action_6,QtCore.SIGNAL("triggered()"),self.openStockInfo)
        QtCore.QObject.connect(self.ui.action_7,QtCore.SIGNAL("triggered()"),self.openAboutInfo)
    def openAboutInfo(self):
        message = QtGui.QMessageBox(self)
        message.setText("version:2.0\nCopyright (c) 2012 Lv Kaiyang")
        message.exec_()
    def openStockInfo(self): 
        MyStockInfo(MyMainW.DB,self).show()
    def openAddBookInfo(self):
        row=[]
        MyAABook(MyMainW.DB,self,row).show()
    def openBookInfo(self):
        MyBookInfo(MyMainW.DB,self).show()
    def openSupplierInfo(self):
        MySupplierInfo(MyMainW.DB,self).show()
    def openCusInfo(self):
        MyCusInfo(MyMainW.DB,self).show()
Ejemplo n.º 27
0
class MainWindow_EXEC():
    def __init__(self):
        app = QtWidgets.QApplication(sys.argv)

        MainWindow = QtWidgets.QMainWindow()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(MainWindow)

        self.update_calendar()
        self.update_progressbar()

        MainWindow.show()
        sys.exit(app.exec_())

    def update_calendar(self):
        self.ui.calendarWidget.selectionChanged.connect(self.update_date)

    def update_date(self):
        self.ui.dateEdit.setDate(self.ui.calendarWidget.selectedDate())

    def update_progressbar(self):
        radio3 = self.ui.Select.text()
        self.ui.Select.setText('Set Progressbar')
        radio3_upd = self.ui.Select.text()
        print(radio3, radio3_upd)

        self.ui.Select.clicked.connect(self.set_progressbar)

    def set_progressbar(self):
        progress_value = self.ui.progressBar.value()
        print('progressBar: ', progress_value)
        new_value = self.ui.lcdNumber.value()
        self.ui.progressBar.setValue(new_value)
        print('progressBar: ', self.ui.progressBar.value())
Ejemplo n.º 28
0
    def __init__(self, listCircle, listEllipse):
        self.listCircle = listCircle
        self.listEllipse = listEllipse

        self.loginWindow = QtWidgets.QMainWindow()
        self.loginUi = Ui_Login()
        self.loginUi.setupUi(self.loginWindow)
        self.loginUi.signalNew.connect(self.showMainWindow)
        self.loginUi.signalLoad.connect(self.loadFile)

        self.mainWindow = QtWidgets.QMainWindow()
        self.mainWindowUi = Ui_MainWindow()
        self.mainWindowUi.setupUi(self.mainWindow)
        self.mainWindowUi.signalAddCircle.connect(self.showAddCircle)
        self.mainWindowUi.signalAddEllipse.connect(self.showAddEllipse)
        self.mainWindowUi.signalDeleteCircle.connect(self.showDeleteCircle)
        self.mainWindowUi.signalDeleteEllipse.connect(self.showDeleteEllipse)
        self.mainWindowUi.signalEditCircle.connect(self.showEditCircle)
        self.mainWindowUi.signalEditEllipse.connect(self.showEditEllipse)
        self.mainWindowUi.signalClearScreen.connect(self.clearScreen)
        self.mainWindowUi.signalSave.connect(self.saveFile)

        self.addCircleWindow = QtWidgets.QMainWindow()
        self.addCircleUi = Ui_AddCircle()
        self.addCircleUi.setupUi(self.addCircleWindow)
        self.addCircleUi.signal.connect(self.addCircleToList)

        self.addEllipseWindow = QtWidgets.QMainWindow()
        self.addEllipseUi = Ui_AddEllipse()
        self.addEllipseUi.setupUi(self.addEllipseWindow)
        self.addEllipseUi.signal.connect(self.addEllipseToList)

        self.deleteCircleWindow = QtWidgets.QMainWindow()
        self.deleteCircleUi = Ui_DeleteCircle()
        self.deleteCircleUi.setupUi(self.deleteCircleWindow)
        self.deleteCircleUi.signal.connect(self.deleteCircleFromList)

        self.deleteEllipseWindow = QtWidgets.QMainWindow()
        self.deleteEllipseUi = Ui_DeleteEllipse()
        self.deleteEllipseUi.setupUi(self.deleteEllipseWindow)
        self.deleteEllipseUi.signal.connect(self.deleteEllipseFromList)

        self.editCircleWindow = QtWidgets.QMainWindow()
        self.editCircleUi = Ui_EditCircle()
        self.editCircleUi.setupUi(self.editCircleWindow)
        self.editCircleUi.signalComboCircleNameIndexChanged.connect(
            self.comboBoxCircleChanged)
        self.editCircleUi.signalBtnOkEditCircleClicked.connect(
            self.editCircleFromList)

        self.editEllipseWindow = QtWidgets.QMainWindow()
        self.editEllipseUi = Ui_EditEllipse()
        self.editEllipseUi.setupUi(self.editEllipseWindow)
        self.editEllipseUi.signalComboEllipseNameIndexChanged.connect(
            self.comboBoxEllipseChanged)
        self.editEllipseUi.signalBtnOkEditEllipseClicked.connect(
            self.editEllipseFromList)

        self.errorMessage = QtWidgets.QErrorMessage()
Ejemplo n.º 29
0
class MainWindow_EXEC():
    def __init__(self):
        app = QtWidgets.QApplication(sys.argv)

        MainWindow = QtWidgets.QMainWindow()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(MainWindow)

        self.update_tree()
        self.update_calendar()
        self.update_progressbar()

        MainWindow.show()
        sys.exit(app.exec_())

    #----------------------------------------------------------
    def update_tree(self):
        #         self.print_tree()
        self.ui.treeWidget.headerItem().setText(1, 'Header 2')
        self.ui.treeWidget.topLevelItem(0).setText(1, "Item 2")
        self.ui.treeWidget.topLevelItem(0).addChild(
            QtWidgets.QTreeWidgetItem())
        self.ui.treeWidget.topLevelItem(0).child(0).setText(1, "Subitem 2")


#         self.print_tree()
#         print(self.ui.treeWidget.topLevelItem(0).text(1))
#         print(self.ui.treeWidget.topLevelItem(0).text(0))
#         print(self.ui.treeWidget.topLevelItem(0).child(0).text(0))
#         print(self.ui.treeWidget.topLevelItem(0).child(0).text(1))

    def print_tree(self):
        header0 = self.ui.treeWidget.headerItem().text(0)
        header1 = self.ui.treeWidget.headerItem().text(1)
        print(header0 + '\n' + header1 + '\n')

    #----------------------------------------------------------
    def update_calendar(self):
        self.ui.calendarWidget.selectionChanged.connect(self.update_date)

    def update_date(self):
        self.ui.dateEdit.setDate(self.ui.calendarWidget.selectedDate())

    #----------------------------------------------------------
    def update_progressbar(self):
        radio_3 = self.ui.radioButton_3.text()
        self.ui.radioButton_3.setText('Set Progressbar')
        radio_3_upd = self.ui.radioButton_3.text()
        print(radio_3, radio_3_upd)

        self.ui.radioButton_3.clicked.connect(self.set_progressbar)

    def set_progressbar(self):
        progress_value = self.ui.progressBar.value()
        print('progressBar: ', progress_value)

        new_value = self.ui.lcdNumber.value()
        self.ui.progressBar.setValue(new_value)
        print('progressBar: ', self.ui.progressBar.value())
Ejemplo n.º 30
0
    def __init__(self, *args, obj=None, **kwargs):
        super(MainWindow, self).__init__(*args, **kwargs)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        self.ui.pushButton.clicked.connect(
            QtWidgets.QApplication.instance().quit)
        self.ui.PushButton.clicked.connect(self.clickMethod)
Ejemplo n.º 31
0
 def __init__(self):
     super(MainWindowController, self).__init__()
     self.ui = Ui_MainWindow()
     self.ui.setupUi(self)
     self.ui.startPushButton.clicked.connect(self.start_analyse)
     self.ui.kmeansPushButton.clicked.connect(self.kmeans_clustering)
     self.ui.graphResultPushButton.clicked.connect(self.graph_result)
     self.ui.resultTableWidget.resizeColumnsToContents()
Ejemplo n.º 32
0
 def __init__(self):
     super(MyApp, self).__init__()
     self.ui = Ui_MainWindow()
     self.ui.setupUi(self)
     self.ui.btn_toplama.clicked.connect(self.hesapla)
     self.ui.btn_cikarma.clicked.connect(self.hesapla)
     self.ui.btn_carmpa.clicked.connect(self.hesapla)
     self.ui.btn_bolma.clicked.connect(self.hesapla)
Ejemplo n.º 33
0
 def __init__(self):
     super(Window, self).__init__()
     self.ui = Ui_MainWindow()
     self.ui.setupUi(self)
     self.ui.pushButton.clicked.connect(lambda: self.insert())
     self.ui.pushButton_2.clicked.connect(lambda: self.delete())
     self.ui.pushButton_3.clicked.connect(lambda: self.update_())
     self.ui.pushButton_4.clicked.connect(lambda: self.get_())
Ejemplo n.º 34
0
Archivo: qupac.py Proyecto: Kett/tupac
	def setupUi(self, MainWindow):
		global version
		Ui_MainWindow.setupUi(self, MainWindow)
		MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "qupac "+version, None, QtGui.QApplication.UnicodeUTF8))
		self.connect(self.searchField,QtCore.SIGNAL("cursorPositionChanged(int,int)"),self.search)
		self.connect(self.searchField,QtCore.SIGNAL("returnPressed()"),self.searchAur)
		self.connect(self.searchButton,QtCore.SIGNAL("pressed()"),self.searchAur)
		self.connect(self.installButton,QtCore.SIGNAL("pressed()"),self.doInstall)
		self.oldSearchString=""
Ejemplo n.º 35
0
class MainWindow(QtGui.QMainWindow):
    def __init__(self, ip, port=8080, parent=None):
        QtGui.QMainWindow.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.ui.ipAddress.setText(ip)
        self.ui.proxyPort.setValue(port)
        self.ui.startProxy.clicked.connect(self.startStopProxy)
        self.ui.actionQuit.triggered.connect(self.quit)
        self.ui.actionAbout.triggered.connect(self.about)
        self.ui.actionOpen_PCAP.triggered.connect(self.openPCAP)
        self.proxy = None

    def quit(self):
        if self.proxy:
            self.proxy.terminate()
            self.proxy = None
        self.close()

    def about(self):
        QtGui.QMessageBox.about(self, "About", "SWProxy: Summoners War Proxy Tool\nWritten by KaKaRoTo\n\nLicensed under LGPLv3 and available at : \n\thttps://github.com/kakaroto/SWParser\n")

    def openPCAP(self):
        pcap_file = QtGui.QFileDialog.getOpenFileName()
        SWProxy.parse_pcap(pcap_file)

    def log(self, str):
        self.ui.logWindow.addItem(str)

    def startStopProxy(self):
        self.ui.proxyPort.setReadOnly(True)
        self.ui.proxyPort.setEnabled(False)
        self.ui.ipAddress.setReadOnly(True)
        self.ui.ipAddress.setEnabled(False)

        if self.proxy:
            self.ui.startProxy.setText("Start Proxy Server")
            self.ui.startProxy.setEnabled(False)
            self.proxy.terminate()
        else:
            self.ui.startProxy.setText("Stop Proxy Server")
            self.proxy = ProxyThread(self.ui.ipAddress.text(), self.ui.proxyPort.value(), parent=self)
            self.proxy.finished.connect(self.proxyStopped)
            self.proxy.start()

    def proxyStopped(self):
        self.proxy = None
        self.ui.ipAddress.setReadOnly(False)
        self.ui.ipAddress.setEnabled(True)
        self.ui.proxyPort.setReadOnly(False)
        self.ui.proxyPort.setEnabled(True)
        self.ui.startProxy.setEnabled(True)
Ejemplo n.º 36
0
 def setupUi(self, Window):
     Ui_MainWindow.setupUi(self,Window)
     Window.refresh.connect(self.do_refresh)
     self.Window = Window
     self.deviceList.setModel(self.lm)
     self.deviceList.selectionModel().currentChanged.connect(self.cfgStatusUpdate)
     self.cfgButton.clicked.connect(self.configure)
     self.actionConfigure.activated.connect(self.configure)
     self.do_refresh()
     self.monitor = pyudev.Monitor.from_netlink(ctx)
     self.monitor.filter_by(subsystem='usb')
     self.observer = QUDevMonitorObserver(self.monitor)
     self.observer.deviceAdded.connect(self.do_refresh)
     self.observer.deviceRemoved.connect(self.do_refresh)
     self.monitor.start()
Ejemplo n.º 37
0
Archivo: gui.py Proyecto: Pridexs/dit
class MainDialog(QtGui.QDialog):
    def __init__(self, parent=None):
        # RSA
        self.rsa = RSA()

        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.ui.btnGenerate.clicked.connect(self.generateKeys)
        self.ui.btnEncMessage.clicked.connect(self.createEncryptMsgDialog)
        self.ui.btnEncFile.clicked.connect(self.createEncryptFileDialog)
        self.generateKeys()
        self.ui.textPublicKey_n.textChanged.connect(self.onPublicKeyChanged)
        self.ui.textPublicKey_e.textChanged.connect(self.onPublicKeyChanged)
        self.ui.textPrivateKey.textChanged.connect(self.onPrivateKeyChanged)

    def generateKeys(self):
        self.rsa.genKeys()
        n,e = self.rsa.getPublicKey()
        self.ui.textPublicKey_n.setText(str(n))
        self.ui.textPublicKey_e.setText(str(e))
        self.ui.textPrivateKey.setText(str(self.rsa.getPrivateKey()))

    def createEncryptMsgDialog(self):
        encryptDialog = EncryptDialog(self.rsa, self)
        encryptDialog.show()

    def createEncryptFileDialog(self):
        encryptFileDialog = EncryptFileDialog(self.rsa, self)
        encryptFileDialog.show()

    def onPublicKeyChanged(self):
        try:
            n = int(self.ui.textPublicKey_n.toPlainText())
            e = int(self.ui.textPublicKey_e.toPlainText())
            self.rsa.setPublicKey(n, e)
        except:
            print('Error.')

    def onPrivateKeyChanged(self):
        try:
            d = int(self.ui.textPrivateKey.toPlainText())
            self.rsa.setPrivateKey(d)
        except:
            print('Invalid Key')
    def __init__(self, parent=None):

        QtGui.QMainWindow.__init__(self, parent)
        self.layout = QtGui.QGridLayout()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.load_data_tipo()
        self.signals()
        self.show()
Ejemplo n.º 39
0
class App(QtGui.QMainWindow):
    def __init__(self):
        QtGui.QMainWindow.__init__(self)

        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        #Add OpenGL widget to main window
        self.gl_widget = GLWidget(self)
        self.ui.main_layout.addWidget(self.gl_widget)

        #Connect gui controls to model
        self.ui.zoom_slider.valueChanged.connect(self.gl_widget.zoom)
        self.ui.elevation_slider.valueChanged.connect(self.gl_widget.elevation)
        self.ui.azimuth_slider.valueChanged.connect(self.gl_widget.azimuth)
        self.ui.wireframe_check.toggled.connect(self.gl_widget.wire)
        self.ui.axes_check.toggled.connect(self.gl_widget.show_axes)
        self.ui.perspective_check.toggled.connect(self.gl_widget.set_projection)
Ejemplo n.º 40
0
    def __init__(self):
        QtGui.QMainWindow.__init__(self)

        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        self.ui.connect_button.clicked.connect(self.start)
        self.ui.send_button.clicked.connect(self.send_msg)

        self.client = None
Ejemplo n.º 41
0
 def __init__(self) :
   QtGui.QMainWindow.__init__(self)
   self.ui = Ui_MainWindow()
   self.ui.setupUi(self)
   self.chartrow = 0
   self.chartcol = 0
   self.ui.frmNotify.hide()
   self.sheetrow = 0
   self.propertyChanged = functools_partial(PyFinModelsApp.propertyChangeEvent, self)
   self.connect(self.ui.tblSheet, QtCore.SIGNAL('itemChanged(QTableWidgetItem *)'), self.propertyChangeEvent)
Ejemplo n.º 42
0
 def __init__(self, ip, port=8080, parent=None):
     QtGui.QMainWindow.__init__(self, parent)
     self.ui = Ui_MainWindow()
     self.ui.setupUi(self)
     self.ui.ipAddress.setText(ip)
     self.ui.proxyPort.setValue(port)
     self.ui.startProxy.clicked.connect(self.startStopProxy)
     self.ui.actionQuit.triggered.connect(self.quit)
     self.ui.actionAbout.triggered.connect(self.about)
     self.ui.actionOpen_PCAP.triggered.connect(self.openPCAP)
     self.proxy = None
Ejemplo n.º 43
0
    def __init__(self, parent=None):
        QtGui.QMainWindow.__init__(self)

        # Init lists
        self.ipAddressesList = ['All']
        self.spacecraftNames = ['All']

        # Init GUI and set callback methods for buttons
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.ui.pushButtonStartTlm.clicked.connect(self.startTlmSystem)
        self.ui.pushButtonStartCmd.clicked.connect(self.startCmdSystem)
Ejemplo n.º 44
0
Archivo: gui.py Proyecto: Pridexs/dit
    def __init__(self, parent=None):
        # RSA
        self.rsa = RSA()

        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.ui.btnGenerate.clicked.connect(self.generateKeys)
        self.ui.btnEncMessage.clicked.connect(self.createEncryptMsgDialog)
        self.ui.btnEncFile.clicked.connect(self.createEncryptFileDialog)
        self.generateKeys()
        self.ui.textPublicKey_n.textChanged.connect(self.onPublicKeyChanged)
        self.ui.textPublicKey_e.textChanged.connect(self.onPublicKeyChanged)
        self.ui.textPrivateKey.textChanged.connect(self.onPrivateKeyChanged)
Ejemplo n.º 45
0
 def __init__(self, db,parent=None):
     MyMainW.DB=db
     QtGui.QMainWindow.__init__(self,parent)
     self.ui = Ui_MainWindow()
     self.ui.setupUi(self)
     self.ui.lineEdit.setText(time.strftime('%Y-%m-%d ',time.localtime(time.time())))
     str="Welcome! Happy Every Day!"
     self.ui.textEdit.setText(str)
             
     QtCore.QObject.connect(self.ui.action_2,QtCore.SIGNAL("triggered()"),self.openBookInfo)
     QtCore.QObject.connect(self.ui.action_3,QtCore.SIGNAL("triggered()"),self.openSupplierInfo)
     QtCore.QObject.connect(self.ui.action_4,QtCore.SIGNAL("triggered()"),self.openCusInfo)
     QtCore.QObject.connect(self.ui.action_5,QtCore.SIGNAL("triggered()"),self.openAddBookInfo)
     QtCore.QObject.connect(self.ui.action_6,QtCore.SIGNAL("triggered()"),self.openStockInfo)
     QtCore.QObject.connect(self.ui.action_7,QtCore.SIGNAL("triggered()"),self.openAboutInfo)
Ejemplo n.º 46
0
 def __init__(self ,parent = None):
     super(Start, self).__init__()
     self.ui = Ui_MainWindow()
     self.ui.setupUi(self)
     
     self.measurement_Windows = []
     self.masterFilename = 'config&data\master_config.txt'
     self.fileDict = {}
     self.open_master_config()
     
     #signals and slots
     self.ui.button_measurement.clicked.connect(self.measurement)
     self.ui.button_GAS.clicked.connect(self.open_GAS)
     self.ui.button_INST.clicked.connect(self.open_INST)
     self.ui.button_presets.clicked.connect(self.open_Preset)
     self.ui.button_analysis.clicked.connect(self.open_analysis)
Ejemplo n.º 47
0
	def __init__(self,  parent=None):
		"""
		Konstruktor 
		"""

		self.translator_app = QTranslator()
		self.translator_qt = QTranslator()

		QApplication.installTranslator( self.translator_app )
		QApplication.installTranslator( self.translator_qt )

		QWidget.__init__(self,  parent)

		QCoreApplication.setOrganizationName("Caern")
		QCoreApplication.setOrganizationDomain("www.caern.de")
		QCoreApplication.setApplicationName("DiceRoller WoD")
		QCoreApplication.setApplicationVersion(QString.number(PROGRAM_VERSION_MAJOR) +
			"." +
			QString.number(PROGRAM_VERSION_MINOR) +
			"." +
			QString.number(PROGRAM_VERSION_CHANGE)
		)
		QApplication.setWindowIcon(QIcon(":/icons/logo/WoD.png"))

		self.ui = Ui_MainWindow()
		self.ui.setupUi(self)
		
		self.createInfo()

		#self.createLanguageMenu()
		self.instantRoll = InstantRoll()
		self.extendedRoll = ExtendedRoll()

		# Dieser Zähler bestimmt, wie der rollende Würfel angezeigt wird.
		self.timerDice = QTimer()
		# Verzögert die tatsächliche Ausführung des Würfelwurfs.
		self.timerRoll = QTimer()
		
		self.populateUi()
		self.createConnections()
		self.initializing()

		self.setWindowTitle(QCoreApplication.applicationName())
Ejemplo n.º 48
0
    def __init__(self, parent=None):

        QtGui.QMainWindow.__init__(self, parent)
        self.ui = Ui_MainWindow()
        # self.ui.setupUi(self)   
        # super(Window, self).__init__(parent)
        self.ui.setupUi(self)

        self.connect(self.ui.addParticipantButton, QtCore.SIGNAL('pressed()'),self.newParticipant)
        self.connect(self.ui.removeParticipantButton, QtCore.SIGNAL('pressed()'),self.removeParticipant)
        self.connect(self.ui.listOfParticipants, QtCore.SIGNAL("itemChanged(QListWidgetItem*)"),self.changeParticipantName)
        # self.connect(self.ui.listOfParticipants, QtCore.SIGNAL("itemClicked(QListWidgetItem*)"),self.addParticipantToGroup)

        self.connect(self.ui.addGroupButton, QtCore.SIGNAL('pressed()'),self.newGroup)
        self.connect(self.ui.removeGroupButton, QtCore.SIGNAL('pressed()'),self.removeGroup)

        self.connect(self.ui.addToGroupButton, QtCore.SIGNAL('pressed()'),self.addParticipantToGroup)
        self.connect(self.ui.removeFromGroupButton, QtCore.SIGNAL('pressed()'),self.removeParticipantFromGroup)

        self.connect(self.ui.optimizeButton, QtCore.SIGNAL('pressed()'),self.optimizeGroups)
        self.connect(self.ui.chooseFileButton, QtCore.SIGNAL('pressed()'),self.openFile)
Ejemplo n.º 49
0
Archivo: Start.py Proyecto: Jothy/RTQA
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        #Disclaimer
        dlg=AboutDlg.AbtDlg(self)
        dlg.exec_()

        self.CurrentImages=list()
        self.Mode="Manual"#manual by default
        self.Iso=[512,384]
        self.WedgeType=''#Default
        self.ComplexType=''#Default
        self.MSEComplexA='None'
        self.MSEComplexB='None'
        self.MSENSS='None'
        self.MSESSS='None'
        self.MSEPyramid1='None'
        self.MSEPyramid2='None'
        self.reportStr=''

        #Signal-slot connections
        QtCore.QObject.connect(self.ui.actionNewMachine,QtCore.SIGNAL("triggered()"),self.OpenNewMCDlg)
        QtCore.QObject.connect(self.ui.actionLoad_ImagesPF0,QtCore.SIGNAL("triggered()"),self.AnalysePicketFence0)
        QtCore.QObject.connect(self.ui.actionLoad_ImagesPF270,QtCore.SIGNAL("triggered()"),self.AnalysePicketFence270)
        QtCore.QObject.connect(self.ui.actionLoad_ImagesPF90,QtCore.SIGNAL("triggered()"),self.AnalysePicketFence90)
        QtCore.QObject.connect(self.ui.actionLoad_ImagesXWedges,QtCore.SIGNAL("triggered()"),self.AnalyseXWedges)
        QtCore.QObject.connect(self.ui.actionLoad_ImagesYWedges,QtCore.SIGNAL("triggered()"),self.AnalyseYWedges)
        QtCore.QObject.connect(self.ui.actionLoad_ImagesComplexA,QtCore.SIGNAL("triggered()"),self.AnalyseComplexA)
        QtCore.QObject.connect(self.ui.actionLoad_ImagesComplexB,QtCore.SIGNAL("triggered()"),self.AnalyseComplexB)
        QtCore.QObject.connect(self.ui.actionLoad_ImagesPyramid,QtCore.SIGNAL("triggered()"),self.AnalysePyramids)
        QtCore.QObject.connect(self.ui.actionLoad_ImagesSSS,QtCore.SIGNAL("triggered()"),self.AnalyseSSS)
        QtCore.QObject.connect(self.ui.actionLoad_ImagesNSS,QtCore.SIGNAL("triggered()"),self.AnalyseNSS)
        QtCore.QObject.connect(self.ui.actionLoadImages_MLCAlign ,QtCore.SIGNAL("triggered()"),self.AnalyseMLCAlign)
        QtCore.QObject.connect(self.ui.actionGenerate_report ,QtCore.SIGNAL("triggered()"),self.CreatePDFReport)
        QtCore.QObject.connect(self.ui.actionAuto_Generate_Report ,QtCore.SIGNAL("triggered()"),self.AutoReport)
        QtCore.QObject.connect(self.ui.actionAbout,QtCore.SIGNAL("triggered()"),self.ShowAboutDlg)
Ejemplo n.º 50
0
    def __init__(self, parent=None):

        super(MainWindow, self).__init__(parent)
        QtGui.QWidget.__init__(self, parent)

        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        self.ui.actionSalir.triggered.connect(self.close)
        self.ui.actionConfiguracion.triggered.connect(self.Configuracion)
        self.ui.actionAcerca_de.triggered.connect(self.Acerca)

        self.ui.generar.clicked.connect(self.Generar)
        self.ui.pausar.clicked.connect(self.Pausar)
        self.ui.borrar.clicked.connect(self.Borrar)
        self.ui.borrar.clicked.connect(self.ui.senoidal.click)

        self.ui.offset.valueChanged.connect(self.Off)
        self.ui.frecuencia.valueChanged.connect(self.Frec)
        self.ui.senoidal.clicked.connect(self.Senoidal)
        self.ui.triangular.clicked.connect(self.Triangular)
        self.ui.rampa.clicked.connect(self.Rampa)
        self.ui.cuadrada.clicked.connect(self.Cuadrada)
Ejemplo n.º 51
0
Archivo: qupac.py Proyecto: Kett/tupac
	def __init__(self,tupacTalker):
		Ui_MainWindow.__init__(self)
		self.tupacTalker=tupacTalker
Ejemplo n.º 52
0
class MyApplication(QtGui.QMainWindow):
    
    def __init__(self, parent=None):
        QtGui.QMainWindow.__init__(self)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
Ejemplo n.º 53
0
class MainForm(QtGui.QMainWindow):
    def __init__(self, parent=None):

        QtGui.QMainWindow.__init__(self, parent)
        self.ui = Ui_MainWindow()
        # self.ui.setupUi(self)   
        # super(Window, self).__init__(parent)
        self.ui.setupUi(self)

        self.connect(self.ui.addParticipantButton, QtCore.SIGNAL('pressed()'),self.newParticipant)
        self.connect(self.ui.removeParticipantButton, QtCore.SIGNAL('pressed()'),self.removeParticipant)
        self.connect(self.ui.listOfParticipants, QtCore.SIGNAL("itemChanged(QListWidgetItem*)"),self.changeParticipantName)
        # self.connect(self.ui.listOfParticipants, QtCore.SIGNAL("itemClicked(QListWidgetItem*)"),self.addParticipantToGroup)

        self.connect(self.ui.addGroupButton, QtCore.SIGNAL('pressed()'),self.newGroup)
        self.connect(self.ui.removeGroupButton, QtCore.SIGNAL('pressed()'),self.removeGroup)

        self.connect(self.ui.addToGroupButton, QtCore.SIGNAL('pressed()'),self.addParticipantToGroup)
        self.connect(self.ui.removeFromGroupButton, QtCore.SIGNAL('pressed()'),self.removeParticipantFromGroup)

        self.connect(self.ui.optimizeButton, QtCore.SIGNAL('pressed()'),self.optimizeGroups)
        self.connect(self.ui.chooseFileButton, QtCore.SIGNAL('pressed()'),self.openFile)

    def newParticipant(self):
    	# name = random.randrange(0,10)

        i = 0
        while self.ui.listOfParticipants.findItems("participant"+str(i), QtCore.Qt.MatchExactly).__len__() != 0:
            i = i+1
        name = "participant"+str(i)
        
    	participant = lab2.Participant(name)
    	participantItem = QtGui.QListWidgetItem(name)
    	participantItem.setData(32, participant)
    	participantItem.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsEditable)
    	self.ui.listOfParticipants.addItem(participantItem)

    def removeParticipant(self):
    	participantItem = self.ui.listOfParticipants.selectedItems()[0]
    	participant = participantItem.data(32).toPyObject()

        for groupItem in self.ui.listOfGroups.findItems(":"+participant.name, QtCore.Qt.MatchContains):
            groupName = groupItem.text().replace(":"+participant.name, "")
            groupItem.setText(groupName) 
            group = groupItem.data(32).toPyObject()
            group.removeParticipant(participant)

    	self.ui.listOfParticipants.takeItem(self.ui.listOfParticipants.row(participantItem))

    def changeParticipantName(self):
    	participantItem = self.ui.listOfParticipants.selectedItems()[0]
    	participant = participantItem.data(32).toPyObject()
        participantOldName = participant.name
    	participant.name = participantItem.text()
    	participantItem.setData(32, participant)

        for groupItem in self.ui.listOfGroups.findItems(":"+participantOldName, QtCore.Qt.MatchContains):
            groupName = groupItem.text().replace(":"+participantOldName, ":"+participantItem.text())
            groupItem.setText(groupName) 



    def newGroup(self):
        group = lab2.Group([])
        group.participants = []

        i = 0
        while self.ui.listOfGroups.findItems("group"+str(i), QtCore.Qt.MatchStartsWith).__len__() != 0:
            i = i+1
        name = "group"+str(i)

        groupItem = QtGui.QListWidgetItem(name)
        groupItem.setData(32, group)
        groupItem.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
        self.ui.listOfGroups.addItem(groupItem)

    def removeGroup(self):
        groupItem = self.ui.listOfGroups.selectedItems()[0]
        self.ui.listOfGroups.takeItem(self.ui.listOfGroups.row(groupItem))

    def addParticipantToGroup(self):
        participantItem = self.ui.listOfParticipants.selectedItems()[0]
        groupItem = self.ui.listOfGroups.selectedItems()[0]

        participant = participantItem.data(32).toPyObject()
        group = groupItem.data(32).toPyObject()

        if not group.addParticipant(participant) == 0:
            groupName = groupItem.text() + ":" + participant.name
            groupItem.setText(groupName)

    def removeParticipantFromGroup(self):
        participantItem = self.ui.listOfParticipants.selectedItems()[0]
        groupItem = self.ui.listOfGroups.selectedItems()[0]

        participant = participantItem.data(32).toPyObject()
        group = groupItem.data(32).toPyObject()

        if not group.removeParticipant(participant) == 0:
            groupName = groupItem.text().replace(":"+participant.name, "")
            groupItem.setText(groupName)

    def optimizeGroups(self):

        groupList = lab2.Grouping()
        
        for groupItem in self.ui.listOfGroups.findItems("group", QtCore.Qt.MatchStartsWith):
            group = groupItem.data(32).toPyObject()
            groupList.addGroup(group)

        groupList.optimize()

        for groupItem in self.ui.listOfGroups.findItems("group", QtCore.Qt.MatchStartsWith):
            group = groupItem.data(32).toPyObject()
            if not group in groupList.group_list:
                self.ui.listOfGroups.takeItem(self.ui.listOfGroups.row(groupItem))


    def openFile(self):
        filename = QtGui.QFileDialog.getOpenFileNames(self, 'Open File')
Ejemplo n.º 54
0
Archivo: Start.py Proyecto: Jothy/RTQA
class StartQT4(QtGui.QMainWindow):
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        #Disclaimer
        dlg=AboutDlg.AbtDlg(self)
        dlg.exec_()

        self.CurrentImages=list()
        self.Mode="Manual"#manual by default
        self.Iso=[512,384]
        self.WedgeType=''#Default
        self.ComplexType=''#Default
        self.MSEComplexA='None'
        self.MSEComplexB='None'
        self.MSENSS='None'
        self.MSESSS='None'
        self.MSEPyramid1='None'
        self.MSEPyramid2='None'
        self.reportStr=''

        #Signal-slot connections
        QtCore.QObject.connect(self.ui.actionNewMachine,QtCore.SIGNAL("triggered()"),self.OpenNewMCDlg)
        QtCore.QObject.connect(self.ui.actionLoad_ImagesPF0,QtCore.SIGNAL("triggered()"),self.AnalysePicketFence0)
        QtCore.QObject.connect(self.ui.actionLoad_ImagesPF270,QtCore.SIGNAL("triggered()"),self.AnalysePicketFence270)
        QtCore.QObject.connect(self.ui.actionLoad_ImagesPF90,QtCore.SIGNAL("triggered()"),self.AnalysePicketFence90)
        QtCore.QObject.connect(self.ui.actionLoad_ImagesXWedges,QtCore.SIGNAL("triggered()"),self.AnalyseXWedges)
        QtCore.QObject.connect(self.ui.actionLoad_ImagesYWedges,QtCore.SIGNAL("triggered()"),self.AnalyseYWedges)
        QtCore.QObject.connect(self.ui.actionLoad_ImagesComplexA,QtCore.SIGNAL("triggered()"),self.AnalyseComplexA)
        QtCore.QObject.connect(self.ui.actionLoad_ImagesComplexB,QtCore.SIGNAL("triggered()"),self.AnalyseComplexB)
        QtCore.QObject.connect(self.ui.actionLoad_ImagesPyramid,QtCore.SIGNAL("triggered()"),self.AnalysePyramids)
        QtCore.QObject.connect(self.ui.actionLoad_ImagesSSS,QtCore.SIGNAL("triggered()"),self.AnalyseSSS)
        QtCore.QObject.connect(self.ui.actionLoad_ImagesNSS,QtCore.SIGNAL("triggered()"),self.AnalyseNSS)
        QtCore.QObject.connect(self.ui.actionLoadImages_MLCAlign ,QtCore.SIGNAL("triggered()"),self.AnalyseMLCAlign)
        QtCore.QObject.connect(self.ui.actionGenerate_report ,QtCore.SIGNAL("triggered()"),self.CreatePDFReport)
        QtCore.QObject.connect(self.ui.actionAuto_Generate_Report ,QtCore.SIGNAL("triggered()"),self.AutoReport)
        QtCore.QObject.connect(self.ui.actionAbout,QtCore.SIGNAL("triggered()"),self.ShowAboutDlg)




    def ShowAboutDlg(self):
        dlg=AboutDlg.AbtDlg(self)
        dlg.exec_()

    def OpenNewMCDlg(self):
        # dlg=NewMCDlg.newMCDlg(self)
        # dlg.exec_()
        pass

    def SelectMCDlg(self):
        dlg=NewMCDlg.newMCDlg(self)
        dlg.exec_()

    def AnalysePicketFence0(self):
        if self.Mode=="Manual":
            files=QFileDialog(self)
            files.setWindowTitle('Picket Fence 0')
            self.CurrentImages=files.getOpenFileNames(self,caption='Continuous Stripes (1)')

        ContStripesDlg1=ContStripesDlg.ContStripesWidget(self)
        #ContStripesDlg1.Img=DCMReader.ReadDCMFile(str(self.CurrentImages[0]))

        mypf = PicketFence(str(self.CurrentImages[0]))

        mypf.image.check_inversion()
        mypf.analyze(tolerance=0.5, action_tolerance=0.3,hdmlc=False)
        mypf.save_analyzed_image('PicketFence0',gaurd_rails=True,mlc_peaks=True,overlay=True,leaf_error_subplot=True)
        #print(mypf.num_pickets,'No. of pickets found')
        #print(mypf.return_results())
        #mypf.plot_analyzed_image()


        AnalyzedImage=pl.imread('PicketFence0.png')
        ContStripesDlg1.Stripes.axes.imshow(AnalyzedImage)
        ContStripesDlg1.ResultsLabel.setText(mypf.return_results())
        #mypf.plot_analyzed_image(ContStripesDlg1.Stripes)
        numPickets=str(mypf.num_pickets)
        ContStripesDlg1.Stripes.axes.set_title("No. of pickets found: "+numPickets+"Gantry=0")
        ContStripesDlg1.Stripes.axes.text(5,25,"Tol=0.5mm,Act_Tol=0.3mm",color='g')
        ContStripesDlg1.Stripes.axes.text(5,60,"Warning:Picket & leaf indexing starts with 0",color='r')
        self.SaveWidgetScreenShot(ContStripesDlg1,'PicketFence0.jpg')

        ContStripesDlg1.Stripes.axes.arrow(25,550, 50,0, head_width=10, head_length=25, fc='b', ec='b')
        ContStripesDlg1.Stripes.axes.arrow(25,550,0,-50, head_width=10, head_length=25, fc='b', ec='b')
        ContStripesDlg1.Stripes.axes.text(35,570,"Count",color='gray')
        ContStripesDlg1.Stripes.axes.text(5,515,"Count",color='gray',rotation=90)

        ContStripesDlg1.Stripes.axes.set_xlabel("Pixel No. G-T")
        ContStripesDlg1.Stripes.axes.set_ylabel("Pixel No. A-B")

        if self.Mode=="Manual":
            ContStripesDlg1.Stripes.draw()
            ContStripesDlg1.exec_()

    def AnalysePicketFence270(self):
        if self.Mode=="Manual":
                files=QFileDialog(self)
                files.setWindowTitle('Picket Fence 270')
                self.CurrentImages=files.getOpenFileNames(self,caption='Continuous Stripes (1)')

        ContStripesDlg1=ContStripesDlg.ContStripesWidget(self)
        #ContStripesDlg1.Img=DCMReader.ReadDCMFile(str(self.CurrentImages[0]))

        mypf = PicketFence(str(self.CurrentImages[0]))

        mypf.image.check_inversion()
        mypf.analyze(tolerance=0.5, action_tolerance=0.3,hdmlc=False)
        mypf.save_analyzed_image('PicketFence270',gaurd_rails=True,mlc_peaks=True,overlay=True,leaf_error_subplot=True)
        #print(mypf.num_pickets,'No. of pickets found')
        #print(mypf.return_results())
        #mypf.plot_analyzed_image()


        AnalyzedImage=pl.imread('PicketFence270.png')
        ContStripesDlg1.Stripes.axes.imshow(AnalyzedImage)
        ContStripesDlg1.ResultsLabel.setText(mypf.return_results())
        #mypf.plot_analyzed_image(ContStripesDlg1.Stripes)
        numPickets=str(mypf.num_pickets)
        ContStripesDlg1.Stripes.axes.set_title("No. of pickets found: "+numPickets+"Gantry=270")
        ContStripesDlg1.Stripes.axes.text(5,25,"Tol=0.5mm,Act_Tol=0.3mm",color='g')
        ContStripesDlg1.Stripes.axes.text(5,60,"Warning:Picket & leaf indexing starts with 0",color='r')
        self.SaveWidgetScreenShot(ContStripesDlg1,'PicketFence270.jpg')

        ContStripesDlg1.Stripes.axes.arrow(25,550, 50,0, head_width=10, head_length=25, fc='b', ec='b')
        ContStripesDlg1.Stripes.axes.arrow(25,550,0,-50, head_width=10, head_length=25, fc='b', ec='b')
        ContStripesDlg1.Stripes.axes.text(35,570,"Count",color='gray')
        ContStripesDlg1.Stripes.axes.text(5,515,"Count",color='gray',rotation=90)

        ContStripesDlg1.Stripes.axes.set_xlabel("Pixel No. G-T")
        ContStripesDlg1.Stripes.axes.set_ylabel("Pixel No. A-B")

        if self.Mode=="Manual":
            ContStripesDlg1.Stripes.draw()
            ContStripesDlg1.exec_()

    def AnalysePicketFence90(self):
        if self.Mode=="Manual":
            files=QFileDialog(self)
            files.setWindowTitle('Picket Fence 90')
            self.CurrentImages=files.getOpenFileNames(self,caption='Continuous Stripes (1)')

        ContStripesDlg1=ContStripesDlg.ContStripesWidget(self)
        #ContStripesDlg1.Img=DCMReader.ReadDCMFile(str(self.CurrentImages[0]))

        mypf = PicketFence(str(self.CurrentImages[0]))

        mypf.image.check_inversion()
        mypf.analyze(tolerance=0.5, action_tolerance=0.3,hdmlc=False)
        mypf.save_analyzed_image('PicketFence90',gaurd_rails=True,mlc_peaks=True,overlay=True,leaf_error_subplot=True)
        #print(mypf.num_pickets,'No. of pickets found')
        #print(mypf.return_results())
        #mypf.plot_analyzed_image()


        AnalyzedImage=pl.imread('PicketFence90.png')
        ContStripesDlg1.Stripes.axes.imshow(AnalyzedImage)
        ContStripesDlg1.ResultsLabel.setText(mypf.return_results())
        #mypf.plot_analyzed_image(ContStripesDlg1.Stripes)
        numPickets=str(mypf.num_pickets)
        ContStripesDlg1.Stripes.axes.set_title("No. of pickets found: "+numPickets+"Gantry=90")
        ContStripesDlg1.Stripes.axes.text(5,25,"Tol=0.5mm,Act_Tol=0.3mm",color='g')
        ContStripesDlg1.Stripes.axes.text(5,60,"Warning:Picket & leaf indexing starts with 0",color='r')
        self.SaveWidgetScreenShot(ContStripesDlg1,'PicketFence90.jpg')

        ContStripesDlg1.Stripes.axes.arrow(25,550, 50,0, head_width=10, head_length=25, fc='b', ec='b')
        ContStripesDlg1.Stripes.axes.arrow(25,550,0,-50, head_width=10, head_length=25, fc='b', ec='b')
        ContStripesDlg1.Stripes.axes.text(35,570,"Count",color='gray')
        ContStripesDlg1.Stripes.axes.text(5,515,"Count",color='gray',rotation=90)

        ContStripesDlg1.Stripes.axes.set_xlabel("Pixel No. G-T")
        ContStripesDlg1.Stripes.axes.set_ylabel("Pixel No. A-B")

        if self.Mode=="Manual":
            ContStripesDlg1.Stripes.draw()
            ContStripesDlg1.exec_()

    def AnalyseWedges(self,title):
        if self.Mode=="Manual":
            files=QFileDialog(self)
            files.setWindowTitle(title)
            if title=='XWedges':
                self.CurrentImages=files.getOpenFileNames(self,caption='X-Wedges')
            else:
                 self.CurrentImages=files.getOpenFileNames(self,caption='Y-Wedges')

        WedgeDlg1=WedgeDlg.WedgeWidget(self)
        WedgeDlg1.setWindowTitle(title)

        yWedge1=DCMReader.ReadDCMFile(str(self.CurrentImages[0]))
        WedgeDlg1.Img1=yWedge1
        WedgeDlg1.Wedge1.axes.imshow(WedgeDlg1.Img1,cmap='gray')
        if self.WedgeType=='X':
            WedgeDlg1.Wedge1.axes.set_title('Wedge1 -X')
        else:
            WedgeDlg1.Wedge1.axes.set_title('Wedge1 -Y')
        WedgeDlg1.Wedge1.axes.hold(True)

        EPIDType=np.shape(yWedge1)
        if EPIDType[0]==768:
            WedgeDlg1.Wedge1.axes.plot(self.Iso[0],self.Iso[1],'y+',markersize=20)
        else:
            WedgeDlg1.Wedge1.axes.plot(256,192,'y+',markersize=20)


        WedgeDlg1.Wedge1.axes.set_xlabel('Pixel No. A-B')
        WedgeDlg1.Wedge1.axes.set_ylabel('Pixel No. T-G')
        if self.Mode=="Manual":
            WedgeDlg1.Wedge1.draw()

        yWedge2=DCMReader.ReadDCMFile(str(self.CurrentImages[1]))
        WedgeDlg1.Img2=yWedge2
        WedgeDlg1.Wedge2.axes.imshow(WedgeDlg1.Img2,cmap='gray')
        if self.WedgeType=='X':
            WedgeDlg1.Wedge2.axes.set_title('Wedge2 -x')
        else:
            WedgeDlg1.Wedge2.axes.set_title('Wedge2 -y')
        WedgeDlg1.Wedge2.axes.hold(True)
        if EPIDType[0]==768:
            WedgeDlg1.Wedge2.axes.plot(self.Iso[0],self.Iso[1],'y+',markersize=20)
        else:
            WedgeDlg1.Wedge2.axes.plot(256,192,'y+',markersize=20)

        WedgeDlg1.Wedge2.axes.set_xlabel('Pixel No. A-B')
        WedgeDlg1.Wedge2.axes.set_ylabel('Pixel No. T-G')
        if self.Mode=="Manual":
            WedgeDlg1.Wedge2.draw()

        combiWedges=yWedge1+yWedge2
        WedgeDlg1.Img3=combiWedges
        WedgeDlg1.CombinedWedges.axes.imshow(WedgeDlg1.Img3,cmap='gray')
        if self.WedgeType=='X':
            WedgeDlg1.CombinedWedges.axes.set_title('Combined Wedges-X')
        else:
            WedgeDlg1.CombinedWedges.axes.set_title('Combined Wedges-Y')
        WedgeDlg1.CombinedWedges.axes.hold(True)
        if EPIDType[0]==768:
            WedgeDlg1.CombinedWedges.axes.plot(self.Iso[0],self.Iso[1],'y+',markersize=20)
        else:
            WedgeDlg1.CombinedWedges.axes.plot(256,192,'y+',markersize=20)

        # WedgeDlg1.CombinedWedges.axes.set_xlim(0,1024)
        # WedgeDlg1.CombinedWedges.axes.set_ylim(0,768)
        WedgeDlg1.CombinedWedges.axes.set_xlabel('Pixel No. A-B')
        WedgeDlg1.CombinedWedges.axes.set_ylabel('Pixel No. T-G')

        if self.Mode=="Manual":
            WedgeDlg1.CombinedWedges.draw()

        WedgeDlg1.plotProfiles(self.WedgeType)
        #print(self.WedgeType,"WedgeType")

        if self.Mode=="Manual":
            WedgeDlg1.exec_()
        if self.WedgeType=='X':
            self.SaveWidgetScreenShot(WedgeDlg1,'XWedges.jpg')
        if self.WedgeType=='Y':
            self.SaveWidgetScreenShot(WedgeDlg1,'YWedges.jpg')

    def AnalyseXWedges(self):
        self.WedgeType='X'
        self.AnalyseWedges('XWedges')

    def AnalyseYWedges(self):
        self.WedgeType='Y'
        self.AnalyseWedges('YWedges')

    def AnalyseComplexFields(self,ComplexType):
        files=QFileDialog(self)
        #Read images only if not in auto mode
        if self.Mode!="Auto":
            if ComplexType=='A':
                files.setWindowTitle('ComplexA')
                self.CurrentImages=files.getOpenFileNames(self,caption='ComplexA')
            else:
                files.setWindowTitle('ComplexB')
                self.CurrentImages=files.getOpenFileNames(self,caption='ComplexB')

        ComplexDlg1=ComplexDlg.ComplexABWidget(self)
        if ComplexType=='A':
            ComplexDlg1.setWindowTitle('ComplexA')
        else:
            ComplexDlg1.setWindowTitle('ComplexB')

        ComplexField=DCMReader.ReadDCMFile(self.CurrentImages[0])
        EPIDType=(np.shape(ComplexField))
        #print(EPIDType[0],EPIDType[1])



        ComplexDlg1.Img1=ComplexField
        ComplexDlg1.mplwidget.axes.imshow(ComplexDlg1.Img1,cmap='gray')


        ComplexDlg1.mplwidget.axes.hold(True)
        ComplexDlg1.mplwidget.axes.plot(self.Iso[0],self.Iso[1],'y+',markersize=20)
        ComplexDlg1.mplwidget.axes.set_xlim(0,EPIDType[1])
        ComplexDlg1.mplwidget.axes.set_ylim(0,EPIDType[0])
        ComplexDlg1.mplwidget.axes.set_xlabel('Pixel No. A-B')
        ComplexDlg1.mplwidget.axes.set_ylabel('Pixel No. T-G')

        edge_sobel = sobel(ComplexDlg1.Img1)
        ComplexDlg1.mplwidget.axes.hold(True)
        ComplexDlg1.mplwidget.axes.imshow(edge_sobel,cmap='spring')
        ComplexDlg1.cmap.setCurrentIndex(4)

        #print(self.ComplexType,"ComplexType")
        if self.ComplexType=='A':
            ComplexDlg1.mplwidget.axes.set_title('ComplexA')
            self.SaveWidgetScreenShot(ComplexDlg1,'ComplexA.jpg')
            pl.imsave('ComplexA.jpg',ComplexDlg1.Img1)
            Img1=pl.imread('ComplexA.jpg')
            if EPIDType[0]==384:
                Img2=pl.imread('ComplexAOrgRefas500.jpg')
            else:
                Img2=pl.imread('ComplexAOrgRef.jpg')
            self.MSEComplexA=np.round(self.mse(Img1,Img2))
            #print(self.MSEComplexA)
        elif self.ComplexType=='B':
            ComplexDlg1.mplwidget.axes.set_title('ComplexB')
            self.SaveWidgetScreenShot(ComplexDlg1,'ComplexB.jpg')
            pl.imsave('ComplexB.jpg',ComplexDlg1.Img1)
            Img1=pl.imread('ComplexB.jpg')
            if EPIDType[0]==384:
                Img2=pl.imread('ComplexBOrgRefas500.jpg')
            else:
                Img2=pl.imread('ComplexBOrgRef.jpg')
            self.MSEComplexB=np.round(self.mse(Img1,Img2))
            #print(self.MSEComplexB)

        if self.Mode=="Manual":
            ComplexDlg1.mplwidget.draw()
            ComplexDlg1.exec_()

    def AnalyseComplexA(self):
          self.ComplexType='A'
          self.AnalyseComplexFields(self.ComplexType)

    def AnalyseComplexB(self):
         self.ComplexType='B'
         self.AnalyseComplexFields(self.ComplexType)

    def AnalysePyramids(self):
        if self.Mode=="Manual":
            files=QFileDialog(self)
            files.setWindowTitle('Pyramids')
            self.CurrentImages=files.getOpenFileNames(self,caption='Pyramids')


        PyramidDlg1=PyramidDlg.PyramidWidget(self)
        PyramidDlg1.Img1=DCMReader.ReadDCMFile(str(self.CurrentImages[0]))
        PyramidDlg1.Img2=DCMReader.ReadDCMFile(str(self.CurrentImages[1]))
        PyramidDlg1.cmap1.setCurrentIndex(3)
        PyramidDlg1.cmap2.setCurrentIndex(3)

        EPIDType=np.shape(PyramidDlg1.Img1)

        PyramidDlg1.pyramid1.axes.imshow(PyramidDlg1.Img1,cmap='cool')
        edge_sobel1 = sobel(PyramidDlg1.Img1)
        PyramidDlg1.pyramid1.axes.hold(True)
        PyramidDlg1.pyramid1.axes.imshow(edge_sobel1,cmap='cool',alpha=0.5)
        PyramidDlg1.pyramid1.axes.hold(True)
        PyramidDlg1.pyramid1.axes.plot(self.Iso[0],self.Iso[1],'y+',markersize=20)
        # if EPIDType==384:
        #     PyramidDlg1.pyramid1.axes.set_xlim(170,330)
        #     PyramidDlg1.pyramid1.axes.set_ylim(110,270)
        # else:
        #     PyramidDlg1.pyramid1.axes.set_xlim(330,660)
        #     PyramidDlg1.pyramid1.axes.set_ylim(240,540)
        PyramidDlg1.pyramid1.axes.set_xlabel('Pixel No. A-B')
        PyramidDlg1.pyramid1.axes.set_ylabel('Pixel No. T-G')
        PyramidDlg1.pyramid1.draw()

        PyramidDlg1.pyramid2.axes.imshow(PyramidDlg1.Img2,cmap='cool')
        edge_sobel2 = sobel(PyramidDlg1.Img2)
        PyramidDlg1.pyramid2.axes.hold(True)
        PyramidDlg1.pyramid2.axes.imshow(edge_sobel2,cmap='cool',alpha=0.5)
        PyramidDlg1.pyramid2.axes.hold(True)
        PyramidDlg1.pyramid2.axes.plot(self.Iso[0],self.Iso[1],'y+',markersize=20)
        # if EPIDType==384:
        #     PyramidDlg1.pyramid2.axes.set_xlim(170,330)
        #     PyramidDlg1.pyramid2.axes.set_ylim(110,270)
        # else:
        #     PyramidDlg1.pyramid2.axes.set_xlim(330,660)
        #     PyramidDlg1.pyramid2.axes.set_ylim(240,540)

        PyramidDlg1.pyramid2.axes.set_xlabel('Pixel No. A-B')
        PyramidDlg1.pyramid2.axes.set_ylabel('Pixel No. T-G')
        PyramidDlg1.pyramid2.draw()



        if self.Mode=="Manual":
            PyramidDlg1.exec_()
        self.SaveWidgetScreenShot(PyramidDlg1,'Pyramids.jpg')

        pl.imsave('Pyramid1.jpg',PyramidDlg1.Img1)
        Img1=pl.imread('Pyramid1.jpg')
        if EPIDType[0]==384:
            Img2=pl.imread('Pyramid1OrgRefas500.jpg')
        else:
            Img2=pl.imread('Pyramid1OrgRef.jpg')
        self.MSEPyramid1=np.round(self.mse(Img1,Img2))

        pl.imsave('Pyramid2.jpg',PyramidDlg1.Img2)
        Img1=pl.imread('Pyramid2.jpg')
        if EPIDType[0]==384:
            Img2=pl.imread('Pyramid2OrgRefas500.jpg')
        else:
            Img2=pl.imread('Pyramid2OrgRef.jpg')
        self.MSEPyramid2=np.round(self.mse(Img1,Img2))

    def AnalyseContStripes(self):
        files=QFileDialog(self)
        files.setWindowTitle('Picket Fence')
        self.CurrentImages=files.getOpenFileNames(self,caption='Picket Fence')

        ContStripesDlg1=ContStripesDlg.ContStripesWidget(self)
        ContStripesDlg1.Img=DCMReader.ReadDCMFile(str(self.CurrentImages[0]))

        mypf = PicketFence(str(self.CurrentImages[0]))
        mypf.image.check_inversion()
        mypf.analyze(tolerance=0.50, action_tolerance=0.3,hdmlc=False)
        mypf.save_analyzed_image('PicketFence',gaurd_rails=True,mlc_peaks=True,overlay=True)
        #print(mypf.num_pickets,'No. of pickets found')
        print("SID:",mypf.image.SID)


        AnalyzedImage=pl.imread('PicketFence.png')
        ContStripesDlg1.Stripes.axes.imshow(AnalyzedImage)
        ContStripesDlg1.ResultsLabel.setText(mypf.return_results())
        #mypf.plot_analyzed_image(ContStripesDlg1.Stripes)
        ContStripesDlg1.Stripes.draw()
        ContStripesDlg1.exec_()

        self.SaveWidgetScreenShot(ContStripesDlg1,'PicketFence.jpg')

    def AnalyseSSS(self):
        if self.Mode=="Manual":
            files=QFileDialog(self)
            files.setWindowTitle('Synchronised Segment Stripes')
            self.CurrentImages=files.getOpenFileNames(self,caption='Synchronised Segment Stripes')

        SSSDlg1=SSSDlg.SSSWidget(self)
        SSSDlg1.Img1=DCMReader.ReadDCMFile(str(self.CurrentImages[0]))
        SSSDlg1.SSS1.axes.imshow(SSSDlg1.Img1,cmap='gray')

        SSSDlg1.Img2=DCMReader.ReadDCMFile(str(self.CurrentImages[1]))
        SSSDlg1.SSS2.axes.imshow(SSSDlg1.Img2,cmap='gray')

        SSSDlg1.Img3=DCMReader.ReadDCMFile(str(self.CurrentImages[2]))
        SSSDlg1.SSS3.axes.imshow(SSSDlg1.Img3,cmap='gray')

        SSSDlg1.Img4=DCMReader.ReadDCMFile(str(self.CurrentImages[3]))
        SSSDlg1.SSS4.axes.imshow(SSSDlg1.Img4,cmap='gray')

        SSSDlg1.ImgCombi=SSSDlg1.Img1+SSSDlg1.Img2+SSSDlg1.Img3+SSSDlg1.Img4
        SSSDlg1.SSSCombi.axes.imshow(SSSDlg1.ImgCombi,cmap='gray')

        EPIDType=np.shape(SSSDlg1.Img1)

        pl.imsave('SSS.jpg',SSSDlg1.ImgCombi)
        Img1=pl.imread('SSS.jpg')
        if EPIDType[0]==384:
            Img2=pl.imread('SSSOrgRefas500.jpg')
        else:
            Img2=pl.imread('SSSOrgRef.jpg')
        self.MSESSS=np.round(self.mse(Img1,Img2))

        if self.Mode=="Manual":
            SSSDlg1.exec_()

    def AnalyseNSS(self):
        if self.Mode=="Manual":
            files=QFileDialog(self)
            files.setWindowTitle('Non-Synchronised Segment Stripes')
            self.CurrentImages=files.getOpenFileNames(self,caption='Non-Synchronised Segment Stripes')

        SSSDlg1=SSSDlg.SSSWidget(self)
        SSSDlg1.Img1=DCMReader.ReadDCMFile(str(self.CurrentImages[0]))
        SSSDlg1.SSS1.axes.imshow(SSSDlg1.Img1,cmap='gray')

        SSSDlg1.Img2=DCMReader.ReadDCMFile(str(self.CurrentImages[1]))
        SSSDlg1.SSS2.axes.imshow(SSSDlg1.Img2,cmap='gray')

        SSSDlg1.Img3=DCMReader.ReadDCMFile(str(self.CurrentImages[2]))
        SSSDlg1.SSS3.axes.imshow(SSSDlg1.Img3,cmap='gray')

        SSSDlg1.Img4=DCMReader.ReadDCMFile(str(self.CurrentImages[3]))
        SSSDlg1.SSS4.axes.imshow(SSSDlg1.Img4,cmap='gray')

        SSSDlg1.ImgCombi=SSSDlg1.Img1+SSSDlg1.Img2+SSSDlg1.Img3+SSSDlg1.Img4
        SSSDlg1.SSSCombi.axes.imshow(SSSDlg1.ImgCombi,cmap='gray')

        EPIDType=np.shape(SSSDlg1.Img1)

        pl.imsave('NSS.jpg',SSSDlg1.ImgCombi)
        Img1=pl.imread('NSS.jpg')
        if EPIDType[0]==384:
            Img2=pl.imread('NSSOrgRefas500.jpg')
        else:
            Img2=pl.imread('NSSOrgRef.jpg')
        self.MSENSS=np.round(self.mse(Img1,Img2))

        if self.Mode=="Manual":
            SSSDlg1.exec_()

    def AnalyseMLCAlign(self):
        files=QFileDialog(self)
        files.setWindowTitle('MLC Alignment')
        if self.Mode=="Manual":
            self.CurrentImages=files.getOpenFileNames(self,caption='MLC ALignment (2)')

        MLCAlignDlg1=MLCAlignDlg.MLCAlignWidget(self)

        MLC1=DCMReader.ReadDCMFile(str(self.CurrentImages[0]))
        MLCAlignDlg1.Img1=MLC1

        MLC2=DCMReader.ReadDCMFile(str(self.CurrentImages[1]))
        MLCAlignDlg1.Img2=MLC2

        MLCAlignDlg1.Img3=MLCAlignDlg1.Img1+MLCAlignDlg1.Img2
        EPIDType=(np.shape(MLC1))

        MLCAlignDlg1.MLCAlignWidget.axes.imshow(MLCAlignDlg1.Img3,cmap='cool')
        MLCAlignDlg1.MLCAlignWidget.axes.set_title('MLC Alignment')
        MLCAlignDlg1.MLCAlignWidget.axes.hold(True)
        #1mm x-guard lines
        xLine1=np.linspace(0,EPIDType[1],50)
        if EPIDType[0]==384:
            spacing=0.784
        else:
            spacing=0.397
        xLine2=np.ones(50)*(EPIDType[0]/2.0)-(0.5/spacing)#0.5 mm away from centreline
        MLCAlignDlg1.MLCAlignWidget.axes.plot(xLine1,xLine2,color='y',linewidth=1)
        xLine3=np.linspace(0,EPIDType[1],50)
        xLine4=np.ones(50)*(EPIDType[0]/2.0)+(0.5/spacing)#0.5 mm away from centreline
        MLCAlignDlg1.MLCAlignWidget.axes.plot(xLine3,xLine4,color='y',linewidth=1)

        #1mm y-guard lines
        yLine1=np.linspace(0,EPIDType[0],50)
        yLine2=np.ones(50)*(EPIDType[1]/2.0)-(0.5/spacing)#0.5 mm away from centreline
        MLCAlignDlg1.MLCAlignWidget.axes.plot(yLine2,yLine1,color='y',linewidth=1)
        yLine3=np.linspace(0,EPIDType[0],50)
        yLine4=np.ones(50)*(EPIDType[1]/2.0)+(0.5/spacing)#0.5 mm away from centreline
        MLCAlignDlg1.MLCAlignWidget.axes.plot(yLine4,yLine3,color='y',linewidth=1)

        #MLCAlignDlg1.MLCAlignWidget.axes.plot(self.Iso[0],self.Iso[1],'y+',markersize=20)
        MLCAlignDlg1.MLCAlignWidget.axes.set_xlim(0,EPIDType[1])
        MLCAlignDlg1.MLCAlignWidget.axes.set_ylim(0,EPIDType[0])
        MLCAlignDlg1.MLCAlignWidget.axes.set_xlabel('Pixel No. A-B')
        MLCAlignDlg1.MLCAlignWidget.axes.set_ylabel('Pixel No. T-G')
        MLCAlignDlg1.MLCAlignWidget.draw()
        self.SaveWidgetScreenShot(MLCAlignDlg1,'MLCAlignment.jpg')

        if self.Mode=="Manual":
            MLCAlignDlg1.exec_()

    def SaveWidgetScreenShot(self,Widget,filename):
        pixelMap=QPixmap(Widget.size())
        Widget.render(pixelMap, QPoint(), QRegion(Widget.size()))
        pixelMap.save(filename,quality=100)

    def mse(self,imageA, imageB):
        # the 'Mean Squared Error' between the two images is the
        # sum of the squared difference between the two images;
        # NOTE: the two images must have the same dimension
        err = np.sum((imageA.astype("float") - imageB.astype("float")) ** 2)
        err /= float(imageA.shape[0] * imageA.shape[1])
        # return the MSE, the lower the error, the more "similar"
        # the two images are
        return err

    def AnalyseCT(self):
        ct_folder = r"C:\MLC QA\Imgs\MLCQA28AUG2015\QA_Tube_Replc_11092015"
        myct = CBCT(ct_folder)
        myct.analyze()
        myct.return_results()
        myct.plot_analyzed_image()

    def CreatePDFReport(self):
        mcID=QInputDialog.getText(self, "Enter M/C ID", "M/C ID:", 0)
        msrBy=QInputDialog.getText(self, "Initials", "Measured by:", 0)
        if mcID[1]==True and msrBy[1]==True:
            #Setting up header & preparing page
            today=date.today()
            day=str(today.day)
            month=str(today.month)
            year=str(today.year)
            dateStr=day+'_'+month+'_'+year
            self.reportStr="MLCQA"+"_"+dateStr+'.pdf'
            c = canvas.Canvas(self.reportStr,pagesize=A4)
            c.drawImage('Logo.png',350,775,8*cm,1.75*cm)
            text1="MLC QA Report:"+dateStr
            c.drawString(100,800,text1)
            mcIDStr="MC ID:"+mcID[0]
            c.drawString(100,750,mcIDStr)

            #ComplexA
            c.line(50,700,580,700)
            mseStr="Mean Square Error:"+str(self.MSEComplexA)
            c.drawString(270,675,"Complex-A")
            c.drawString(250,650,mseStr)
            c.drawImage('ComplexA.jpg',100,150,15*cm,18*cm,preserveAspectRatio=True)
            text2='Measured by:    '+str(msrBy[0])
            text3='Checked by:_______________'
            c.drawString(100,80,text2)
            c.drawString(100,50,text3)
            c.line(50,125,580,125)

            #ComplexB
            c.showPage()#Move to next page
            c.line(50,700,580,700)
            mseStr="Mean Square Error:"+str(self.MSEComplexB)
            c.drawString(270,675,"Complex-B")
            c.drawString(250,650,mseStr)
            c.drawImage('ComplexB.jpg',100,150,15*cm,18*cm,preserveAspectRatio=True)
            text2='Measured by:    '+str(msrBy[0])
            text3='Checked by:_______________'
            c.drawString(100,80,text2)
            c.drawString(100,50,text3)
            c.line(50,125,580,125)

            #MLC Bank Alignment
            c.showPage()#Move to next page
            c.line(50,700,580,700)
            c.drawString(250,675,"MLC Bank Alignment")
            c.drawImage('MLCAlignment.jpg',100,150,15*cm,18*cm,preserveAspectRatio=True)
            text2='Measured by:    '+str(msrBy[0])
            text3='Checked by:_______________'
            c.drawString(100,80,text2)
            c.drawString(100,50,text3)
            c.line(50,125,580,125)

            #NSS
            c.showPage()#Move to next page
            c.line(50,700,580,700)
            c.drawString(240,675,"Non-synchronised Segment Stripes")
            c.drawImage('NSS.jpg',100,150,15*cm,18*cm,preserveAspectRatio=True)
            mseStr="Mean Square Error:"+str(self.MSENSS)
            c.drawString(270,650,mseStr)
            text2='Measured by:    '+str(msrBy[0])
            text3='Checked by:_______________'
            c.drawString(100,80,text2)
            c.drawString(100,50,text3)
            c.line(50,125,580,125)


            #Picket fence#Gantry=0
            c.showPage()#Move to next page
            c.line(50,700,580,700)
            c.drawString(250,675,"Picket Fence Gantry=0")
            c.drawImage('PicketFence0.jpg',100,150,13*cm,18*cm,preserveAspectRatio=True)
            text2='Measured by:    '+str(msrBy[0])
            text3='Checked by:_______________'
            c.drawString(100,80,text2)
            c.drawString(100,50,text3)
            c.line(50,125,580,125)

            #Picket fence#Gantry=270
            c.showPage()#Move to next page
            c.line(50,700,580,700)
            c.drawString(250,675,"Picket Fence Gantry=270")
            c.drawImage('PicketFence270.jpg',100,150,13*cm,18*cm,preserveAspectRatio=True)
            text2='Measured by:    '+str(msrBy[0])
            text3='Checked by:_______________'
            c.drawString(100,80,text2)
            c.drawString(100,50,text3)
            c.line(50,125,580,125)

            #Picket fence#Gantry=90
            c.showPage()#Move to next page
            c.line(50,700,580,700)
            c.drawString(250,675,"Picket Fence Gantry=90")
            c.drawImage('PicketFence90.jpg',100,150,13*cm,18*cm,preserveAspectRatio=True)
            text2='Measured by:    '+str(msrBy[0])
            text3='Checked by:_______________'
            c.drawString(100,80,text2)
            c.drawString(100,50,text3)
            c.line(50,125,580,125)

            #Pyramid1
            c.showPage()#Move to next page
            c.line(50,700,580,700)
            c.drawString(270,675,"Pyramid1")
            c.drawImage('Pyramid1.jpg',100,150,15*cm,18*cm,preserveAspectRatio=True)
            mseStr="Mean Square Error:"+str(self.MSEPyramid1)
            c.drawString(260,650,mseStr)
            text2='Measured by:    '+str(msrBy[0])
            text3='Checked by:_______________'
            c.drawString(100,80,text2)
            c.drawString(100,50,text3)
            c.line(50,125,580,125)

            #Pyramid2
            c.showPage()#Move to next page
            c.line(50,700,580,700)
            c.drawString(270,675,"Pyramid2")
            c.drawImage('Pyramid2.jpg',100,150,15*cm,18*cm,preserveAspectRatio=True)
            mseStr="Mean Square Error:"+str(self.MSEPyramid2)
            c.drawString(260,650,mseStr)
            text2='Measured by:    '+str(msrBy[0])
            text3='Checked by:_______________'
            c.drawString(100,80,text2)
            c.drawString(100,50,text3)
            c.line(50,125,580,125)

            #SSS
            c.showPage()#Move to next page
            c.line(50,700,580,700)
            c.drawString(240,675,"Synchronised Segment Stripes")
            c.drawImage('NSS.jpg',100,150,15*cm,18*cm,preserveAspectRatio=True)
            mseStr="Mean Square Error:"+str(self.MSESSS)
            c.drawString(270,650,mseStr)
            text2='Measured by:    '+str(msrBy[0])
            text3='Checked by:_______________'
            c.drawString(100,80,text2)
            c.drawString(100,50,text3)
            c.line(50,125,580,125)

            #X-Wedges
            c.showPage()#Move to next page
            c.line(50,700,580,700)
            c.drawString(270,675,"XWedges")
            c.drawImage('XWedges.jpg',100,150,15*cm,18*cm,preserveAspectRatio=True)
            text2='Measured by:    '+str(msrBy[0])
            text3='Checked by:_______________'
            c.drawString(100,80,text2)
            c.drawString(100,50,text3)
            c.line(50,125,580,125)

            #Y-Wedges
            c.showPage()#Move to next page
            c.line(50,700,580,700)
            c.drawString(270,675,"YWedges")
            c.drawImage('YWedges.jpg',100,150,15*cm,18*cm,preserveAspectRatio=True)
            text2='Measured by:    '+str(msrBy[0])
            text3='Checked by:_______________'
            c.drawString(100,80,text2)
            c.drawString(100,50,text3)
            c.line(50,125,580,125)

            #Save the PDF to working dir
            c.save()

    def AutoReport(self):
        self.Mode="Auto"
        dirPath= str(QFileDialog.getExistingDirectory(self, "Select Directory"))
        files=os.listdir(dirPath)


        for x in range (0,np.size(files),1):
            files[x]=dirPath+'\\'+files[x]
        if (np.size(files)!=21):
            errorMsg=QErrorMessage(self)
            errorMsg.setWindowTitle("Error")
            errorMsg.showMessage("No. of files must be 21","Error")
            errorMsg.exec_()
        else:
            QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
            #ComplexA
            self.CurrentImages.append(files[0])
            self.ComplexType='A'
            self.AnalyseComplexFields('A')
            self.CurrentImages.clear()


            #ComplexB
            self.CurrentImages.append(files[1])
            self.ComplexType='B'
            self.AnalyseComplexFields('B')
            self.CurrentImages.clear()


            #MLC Alignment
            self.CurrentImages.append(files[2])
            self.CurrentImages.append(files[3])
            self.AnalyseMLCAlign()
            self.CurrentImages.clear()

            #NSS
            self.CurrentImages.append(files[4])
            self.CurrentImages.append(files[5])
            self.CurrentImages.append(files[6])
            self.CurrentImages.append(files[7])
            self.AnalyseNSS()
            self.CurrentImages.clear()

            #Picket Fence- Gantry =0
            self.CurrentImages.append(files[8])
            self.AnalysePicketFence0()
            self.CurrentImages.clear()

            #Picket Fence- Gantry =270
            self.CurrentImages.append(files[9])
            self.AnalysePicketFence270()
            self.CurrentImages.clear()

            #Picket Fence- Gantry =90
            self.CurrentImages.append(files[10])
            self.AnalysePicketFence90()
            self.CurrentImages.clear()

            #Pyramids
            self.CurrentImages.append(files[11])
            self.CurrentImages.append(files[12])
            self.AnalysePyramids()
            self.CurrentImages.clear()

            #SSS
            self.CurrentImages.append(files[13])
            self.CurrentImages.append(files[14])
            self.CurrentImages.append(files[15])
            self.CurrentImages.append(files[16])
            self.AnalyseSSS()
            self.CurrentImages.clear()


            #X-Wedges
            self.WedgeType='X'
            self.CurrentImages.append(files[17])
            self.CurrentImages.append(files[18])
            self.AnalyseWedges("X")
            self.CurrentImages.clear()

            #Y-Wedges
            self.WedgeType='Y'
            self.CurrentImages.append(files[19])
            self.CurrentImages.append(files[20])
            self.AnalyseWedges("Y")
            self.CurrentImages.clear()

            #Restore normal cursor
            QApplication.restoreOverrideCursor()


            #Create a PDF report
            self.CreatePDFReport()

            #Revert back to manual mode
            self.Mode="Manual"
            os.startfile(self.reportStr)
Ejemplo n.º 55
0
class StartQT4(QtGui.QMainWindow):
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
Ejemplo n.º 56
0
 def __init__(self, parent=None):
     QtGui.QWidget.__init__(self, parent)
     self.ui = Ui_MainWindow()
     self.ui.setupUi(self)
Ejemplo n.º 57
0
 def __init__(self, parent=None):
   QtGui.QWidget.__init__(self,parent)
   self.ui = Ui_MainWindow()
   self.ui.setupUi(self)
   QtCore.QObject.connect(self.ui.pushButtonStart, QtCore.SIGNAL("clicked()"), self.startuj)        
Ejemplo n.º 58
0
class Start(QtGui.QWidget): #the class for the main window
    
    def __init__(self ,parent = None):
        super(Start, self).__init__()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        
        self.measurement_Windows = []
        self.masterFilename = 'config&data\master_config.txt'
        self.fileDict = {}
        self.open_master_config()
        
        #signals and slots
        self.ui.button_measurement.clicked.connect(self.measurement)
        self.ui.button_GAS.clicked.connect(self.open_GAS)
        self.ui.button_INST.clicked.connect(self.open_INST)
        self.ui.button_presets.clicked.connect(self.open_Preset)
        self.ui.button_analysis.clicked.connect(self.open_analysis)
        
    def any_running(self):
        #checks if there are an windows running. Returns a boolean. 
        return any(window.isRunning for window in self.measurement_Windows)
        
    def allow_run(self):
        #checks all the measurement windows and returns true if none are running. Returns False if one is. Ensures that communications to instruments dont' cross paths
        #also checks if any of them have the same datafile
        
        dataFiles = {} #count the apperaences of each dataFilename
        for window in self.measurement_Windows:
            if window.dataFilename not in dataFiles:
                dataFiles[window.dataFilename] = 0
            dataFiles[window.dataFilename]+=1
        
        dataFilesInvalid = any(value>1 for value in dataFiles.itervalues())
        
        measurementRunning = self.any_running()
        
        message = ''
        
        if dataFilesInvalid:
            message = 'There was a conflict with the data files'
        elif measurementRunning:
            message = 'There seems to be a measurement running already.'
        return not dataFilesInvalid and not measurementRunning, message #if the dataFiles are invalid or a measurement is running, we don't want to allow a meausrement
        
    def check_runs(self, callerWindow):
        for window in self.measurement_Windows:
            if window is not callerWindow:
                window.check_run()
            
    def closeEvent(self, event):
        #make sure that all the windows close when the main one does. 
        if self.measurement_Windows:
             response = QtGui.QMessageBox.warning(self, 'Warning!', 'Closing this window will close all the measurements too.\nAre you sure you want to close?', buttons=QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, defaultButton=QtGui.QMessageBox.No)
             if response == QtGui.QMessageBox.No:
                 event.ignore()
                 return
        for window in self.measurement_Windows:
            window.close()
        event.accept()
        
    def measurement(self):
        presetsFile = open(self.fileDict['PRESET'] , 'r')
        
        presetNames = ['None']
        with open(self.fileDict['PRESET'], 'r') as presetFile:
            for line in presetFile: #gather all the names from the preset file
                values = parseKeyValue(line)
                if values is not None and values[0] == 'Name':
                    presetNames.append(values[1])
        
        
        import preset_dialog_main
        self.presetDialog = preset_dialog_main.PresetDialog(presetNames)
        if not self.presetDialog.exec_():
            return
        else:
            presetName = self.presetDialog.getChoice()
            
        if presetName == 'None':
            presetName = None 
            
        from pyvisa import visa_exceptions
        import GASconfig
        try:
            GASdict, INSTdict = GASconfig.getsAndSetsFromConfig(self.fileDict['GAS'])
        except visa_exceptions.VisaIOError:
            QtGui.QMessageBox.warning(self, 'Warning', 'There was a problem opening the connections to the instruments. Check that they are configured.', buttons=QtGui.QMessageBox.Ok, defaultButton=QtGui.QMessageBox.Ok)
            return
            
        import MeasurementGUI_main
        self.measurement_Windows.append(MeasurementGUI_main.Start(self.fileDict, presetName,GASdict, INSTdict, parent = self))
        self.measurement_Windows[-1].showMaximized()
        
    def open_analysis(self):
        #hans't been implemented; instead opens a dialog warning the user
        QtGui.QMessageBox.warning(self, 'Analysis', 'The Analysis feature has not been implemented yet. Sorry!', buttons=QtGui.QMessageBox.Ok, defaultButton=QtGui.QMessageBox.Ok)
        
    def open_GAS(self):
        #opens the GAS config module
        import Gasconfig_GUI_main
        self.gasConfig = Gasconfig_GUI_main.Start(self.fileDict['GAS'], self)
        self.gasConfig.show()
        
    def open_INST(self):
        #opens the INSt config module
        import INSTconfig_GUI_main
        self.INSTconfg = INSTconfig_GUI_main.Start(self.fileDict['INST'], self)
        self.INSTconfg.show()
        
    def open_Preset(self):
        #opens the delete preset dialog. 
        import deletePreset_main
        self.presetConfig = deletePreset_main.deletePreset(self.fileDict['PRESET'])
        self.presetConfig.show()
        
    def open_master_config(self):
        #opens the measurement config and creates the self.fileDict dictionary, listing the files where the configs are stored on this machine
        import os
        
        compName = os.environ['COMPUTERNAME']
        lines = []
        master_config = open(self.masterFilename, 'r')
        
        for line in master_config:
            lines.append(line)
            
        master_config.close()
        
        for index in xrange(len(lines)):
            tup = parseKeyValue(lines[index])
            if tup is not None and tup[1] == compName: #found our computer
                for i in xrange(index + 1, index + 4):
                    tup = parseKeyValue(lines[i])
                    if tup is not None:
                        self.fileDict[tup[0]] = tup[1] #add the file type and name into the dicitonary.
                break
            
    def remove_window(self, child):
        #deletes the window rom the list. This frees up memory
        for index,window in enumerate(self.measurement_Windows):
            if child is window:
                window.close()
                break
        self.measurement_Windows.pop(index) #let the garbage collector delete it
        
    def update_GAS_INST(self):
        #updates the GAS and INST objects for each child window. 
        from pyvisa import visa_exceptions
        import GASconfig
        try:
            GASdict, INSTdict = GASconfig.getsAndSetsFromConfig(self.fileDict['GAS'])
        except visa_exceptions.VisaIOError:
            QtGui.QMessageBox.warning(self, 'Warning', 'There was a problem opening the connections to the instruments. Check that they are configured.', buttons=QtGui.QMessageBox.Ok, defaultButton=QtGui.QMessageBox.Ok)
            return
        
        for window in self.measurement_Windows: #send this update down to the lower windows
            while window.isRunning:
                pass #wait until the window is done running. 
            window.GASdict = GASdict
            window.INSTdict = INSTdict
            window.open_GASFile()
Ejemplo n.º 59
0
class PyFinModelsApp(QtGui.QMainWindow) :
  def __init__(self) :
    QtGui.QMainWindow.__init__(self)
    self.ui = Ui_MainWindow()
    self.ui.setupUi(self)
    self.chartrow = 0
    self.chartcol = 0
    self.ui.frmNotify.hide()
    self.sheetrow = 0
    self.propertyChanged = functools_partial(PyFinModelsApp.propertyChangeEvent, self)
    self.connect(self.ui.tblSheet, QtCore.SIGNAL('itemChanged(QTableWidgetItem *)'), self.propertyChangeEvent)

  def propertyChangeEvent(self, item):
    if isinstance(item, QPropertyVal):
      self.modelProperties.setPropVal(item.associatedProperty(), item.text())
  
  def getSheet(self) :
    return self.ui.tblSheet

  def getCodeEditor(self) :
    return self.ui.txtCode

  def getModelHintsTextbox(self) :
    return self.ui.txtModelHints

  def addProperties(self, mprops) :
    col = 0
    self.modelProperties = mprops
    props = mprops.getProps()
    for key in props :
      itemKey = QtGui.QTableWidgetItem(key)
      itemKey.setBackground(QtGui.QBrush(QtGui.QColor('Gray')))
      fnt = itemKey.font()
      itemKey.setToolTip(mprops.getPropHelp(key))
      fnt.setWeight(QtGui.QFont.Bold)
      itemKey.setFont(fnt)
      itemKey.setFlags(QtCore.Qt.ItemIsEnabled)
      self.getSheet().setItem(self.sheetrow, col, itemKey)

      itemVal = QPropertyVal(str(mprops.getPropVal(key)))
      itemVal.setAssociatedProperty(key)
      itemVal.setBackground(QtGui.QBrush(QtGui.QColor("Red")))
      itemVal.setToolTip(mprops.getPropHelp(key))
      self.getSheet().setItem(self.sheetrow, col + 1, itemVal)
      self.sheetrow += 1

  def addModelActions(self, actionDict) :
    col = 0
    for x in actionDict :
      btn = QtGui.QPushButton(x, self.getSheet())
      btn.setFont(self.getSheet().font())
      ahandler = functools_partial(PyFinModelsApp.actionHandler, self, actionDict[x])
      self.connect(btn, QtCore.SIGNAL('clicked(bool)'), ahandler)
      self.getSheet().setCellWidget(self.sheetrow, col, btn)
      col += 1

  def actionHandler(self, actionTarget):
    actionTarget(self.modelProperties)
    pass
  
  def add1DData(self, name, data) :
    self.sheetrow += 1
    col = 0
    for x in data :
      item = QtGui.QTableWidgetItem(x)
      item.setBackground(QtGui.QBrush(QtGui.QColor("Brown")))
      item.setFlags(QtCore.Qt.ItemIsEnabled)
      self.getSheet().setItem(self.sheetrow, col, item)
      col += 1

  def showOutputHeading(self, name) :
    self.sheetrow += 1
    itemKey = QtGui.QTableWidgetItem(name)
    itemKey.setBackground(QtGui.QBrush(QtGui.QColor("Pink")))
    fnt = itemKey.font()
    fnt.setWeight(QtGui.QFont.Bold)
    itemKey.setFont(fnt)
    itemKey.setFlags(QtCore.Qt.ItemIsEnabled)
    self.getSheet().setItem(self.sheetrow, 0, itemKey)

  def add2DData(self, name, data) :
    self.showOutputHeading(name)
    col = 0
    for x in data :
      self.sheetrow += 1
      col = 0
      for y in x :
        item = QtGui.QTableWidgetItem(str(y))
        item.setBackground(QtGui.QBrush(QtGui.QColor(255, 100, 100)))
        item.setFlags(QtCore.Qt.ItemIsEnabled)
        self.getSheet().setItem(self.sheetrow, col, item)
        col += 1

  def add2DChart(self, name, pyFinChart) :
    self.ui.chartGrid.addWidget(pyFinChart, self.chartrow, self.chartcol)
    if self.chartcol == 3 :
      self.chartrow += 1
      self.chartcol = 0
    else :
      self.chartcol += 1

  def loadModel(self, model) :
    self.getSheet().clearContents()
    self.addProperties(model.getProperties())
    self.addModelActions(model.getModelActions())
Ejemplo n.º 60
0
class MainWindow(QtGui.QMainWindow):  # Configuracion basica, de SEÑALES y de SLOTS de la GUI (ventana principal)
    def __init__(self, parent=None):

        super(MainWindow, self).__init__(parent)
        QtGui.QWidget.__init__(self, parent)

        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        self.ui.actionSalir.triggered.connect(self.close)
        self.ui.actionConfiguracion.triggered.connect(self.Configuracion)
        self.ui.actionAcerca_de.triggered.connect(self.Acerca)

        self.ui.generar.clicked.connect(self.Generar)
        self.ui.pausar.clicked.connect(self.Pausar)
        self.ui.borrar.clicked.connect(self.Borrar)
        self.ui.borrar.clicked.connect(self.ui.senoidal.click)

        self.ui.offset.valueChanged.connect(self.Off)
        self.ui.frecuencia.valueChanged.connect(self.Frec)
        self.ui.senoidal.clicked.connect(self.Senoidal)
        self.ui.triangular.clicked.connect(self.Triangular)
        self.ui.rampa.clicked.connect(self.Rampa)
        self.ui.cuadrada.clicked.connect(self.Cuadrada)

    def Generar(self):  # Funcion del boton "Generar"
        global Control
        Control = "1"

        try:
            Config = self.Configurar()
            signal = dev.write(1, Config, 0, 100)
            if signal:
                print("Se generó la señal")
                print("Se enviaron: " + str(signal) + " bytes: '" + str(Config) + "'")
                print("")
            else:
                print("Se produjo un error en el envio, revise la configuración")
        except:
            print("No se pudo configurar el dispositivo")

    def Pausar(self):  # Funcion del boton "Pausar"
        global Control
        global Config

        if Control == "1" and Control != "0":
            Control = "0"
            Config = self.Configurar()
            signal = dev.write(1, Config, 0, 100)
            print("Se pausó la señal")
            print("Se enviaron: " + str(signal) + " bytes: '" + str(Config) + "'")
            print("")
        else:
            print("La señal ya se encuentra pausada")

    def Borrar(self):  # Funcion del boton "Borrar"
        global Tipo
        global Frecuencia
        global Offset
        global Control
        global Config

        Tipo = "0"  # Seno (tipo por defecto)
        Frecuencia = "5000"  # 5000 Hz (frecuencia por defecto)
        Offset = "0"  # 0V de offset (offset por defecto)
        Control = "0"  # Desactivo la generación de la señal

        self.ui.frecuencia.setValue(5000)
        self.ui.offset.setValue(0)

        Config = self.Configurar()
        try:
            signal = dev.write(1, Config, 0, 100)
            if signal:
                print("Se configuró la señal por defecto")
                print("Se enviaron: " + str(signal) + " bytes: '" + str(Config) + "'")
                print("")
            else:
                print("Se produjo un error en el envio, revise la configuración")
        except:
            print("No se pudo configurar el dispositivo")

    def Senoidal(self):  # Funcion del radio boton "Senoidal"
        global Tipo

        Tipo = "0"
        print("La señal es de tipo senoidal")

    def Triangular(self):  # Funcion del radio boton "Triangular"
        global Tipo

        Tipo = "1"
        print("La señal es de tipo triangular")

    def Rampa(self):  # Funcion del radio boton "Rampa"
        global Tipo

        Tipo = "2"
        print("La señal es de tipo rampa")

    def Cuadrada(self):  # Funcion del radio boton "Cuadrada"
        global Tipo

        Tipo = "3"
        print("La señal es de tipo cuadrada")

    def Frec(self, Frec):  # Funcion del spinbox de "Frecuencia"
        global Frecuencia

        Frecuencia = str(Frec)
        print("Frecuencia: " + Frecuencia)

    def Off(self, Off):  # Funcion del slider de "Offset"
        global Offset

        self.ui.offset.setToolTip(_fromUtf8(str(-self.ui.offset.value())))
        self.ui.lOffset.setText(_fromUtf8(str(-self.ui.offset.value()) + " %"))
        Offset = str(-Off)
        print("Offset: " + Offset)

    def Configurar(self):  # Funcion que genera el vector de configuracion de la señal a enviar por USB
        global Tipo
        global Frecuencia
        global Offset
        global Control

        """
        ORDEN DE LOS BYTES A ENVIAR:
        1er BYTE --> TIPO DE SEÑAL [0 SENOIDAL, 
                                    1 TRIANGULAR, 
                                    2 RAMPA, 
                                    3 CUADRADA] --> N° en ASCII
        2do BYTE --> FRECUENCIA [4] --------------> N° en ASCII                                   
        3er BYTE --> FRECUENCIA [3] --------------> N° en ASCII
        4to BYTE --> FRECUENCIA [2] --------------> N° en ASCII
        5to BYTE --> FRECUENCIA [1] --------------> N° en ASCII
        6to BYTE --> FRECUENCIA [0] --------------> N° en ASCII
        7mo BYTE --> OFFSET [SIGNO] --------------> Signo (+ o -) en ASCII
        8vo BYTE --> OFFSET [2] ------------------> N° en ASCII
        9no BYTE --> OFFSET [1] ------------------> N° en ASCII
        10mo BYTE --> OFFSET [0] -----------------> N° en ASCII
        11vo BYTE --> CONTROL [0 PARA, 1 INICIA] -> N° en ASCII
        """

        if len(str(Frecuencia)) < 5 and len(str(Frecuencia)) > 3:
            Frecuencia = "0" + Frecuencia
        elif len(str(Frecuencia)) < 4 and len(str(Frecuencia)) > 2:
            Frecuencia = "00" + Frecuencia
        elif len(str(Frecuencia)) < 3 and len(str(Frecuencia)) > 1:
            Frecuencia = "000" + Frecuencia
        elif len(str(Frecuencia)) < 2:
            Frecuencia = "0000" + Frecuencia

        if int(Offset) >= 0:
            if len(Offset) == 3:
                Offset = "+" + Offset
            elif len(Offset) < 3 and len(Offset) > 1:
                Offset = "+0" + Offset
            elif len(Offset) < 2:
                Offset = "+00" + Offset

        elif int(Offset) < 0:
            if len(Offset) < 4 and len(Offset) > 2:
                Offset = "-0" + str(-int(Offset))
            elif len(Offset) < 3:
                Offset = "-00" + str(-int(Offset))

        Config = Tipo + str(Frecuencia) + str(Offset) + Control
        print(Config)

        return Config

    def Configuracion(self):  # Funcion de llamada a la ventana de "Configuracion"
        self.w = ConfWindow()
        # self.w.show()
        self.w.exec_()  # Una vez abierta solo se puede interactuar con esta ventana

    def Acerca(self):  # Funcion de llamada a la ventana de informacion "Acerca de..."
        self.w = AcercaWindow()
        # self.w.show()
        self.w.exec_()  # Una vez abierta solo se puede interactuar con esta ventana