class ApplicationWindow(QtWidgets.QMainWindow,Ui_MainWindow): def __init__(self): super(ApplicationWindow, self).__init__() self.ui = Ui_MainWindow() self.ui.setupUi(self) self.ui.Button_song.clicked.connect(self.popWin1) self.ui.Button_party.clicked.connect(self.popWin2) self.ui.Button_ECG.clicked.connect(self.popWin3) def popWin1(self): global application1 application1=pop_window1() application1.show() def popWin2(self): global application2 application2=pop_window2() application2.show() def popWin3(self): global application3 application3=pop_window3() application3.show()
class MainWindow(QtWidgets.QMainWindow): def __init__(self): super(MainWindow, self).__init__() self.ui = Ui_MainWindow() self.ui.setupUi(self) self.ui.actionAbout.triggered.connect(self.about_window) def about_window(self): widget = About() widget.exec_() def handleDisplay(self, data): self.ui.label_10.setText(data[0]['temp'] + ' C' + '\N{DEGREE SIGN}') self.ui.label_2.setText(data[0]['name'][2:-1]) self.ui.label_4.setText(data[0]['total'] + ' GB') self.ui.label_6.setText(data[0]['used'] + ' GB') self.ui.label_8.setText(data[0]['free'] + ' GB')
class Main(QtGui.QMainWindow): def __init__(self): QtGui.QMainWindow.__init__(self) self.ui = Ui_MainWindow() self.ui.setupUi(self) self.ui.pushButton_2.clicked.connect(self.charmarForm) self.ui.pushButton_3.clicked.connect(self.listarPalavras) self.ui.pushButton.clicked.connect(self.soletrando) def charmarForm(self): programa=Formulario() programa.show() self.exit() def listarPalavras(self): programa=ListarPalavras() programa.show() self.exit() def soletrando(self): programa=Soletrando() programa.show() self.exit() Soletrando
class ApplicationWindow(QtWidgets.QMainWindow, Ui_MainWindow): def __init__(self): super(ApplicationWindow, self).__init__() self.ui = Ui_MainWindow() self.ui.setupUi(self) self.CCU = pd.read_excel('data/CCU_Equipment_List.xlsx') self.OR = pd.read_excel('data/OR_Equipment_List.xlsx') self.out_patient = pd.read_excel( 'data/Out_Patient_Equipment_List.xlsx') # Connections self.ui.dep.currentIndexChanged.connect( lambda index: self.get_equipment(index)) self.ui.equipment.currentTextChanged.connect( lambda equip: self.set_serial_num_menu(equip)) self.ui.report.currentIndexChanged.connect( lambda index: self.show_report(index)) def get_equipment(self, index): if index == 1: equipments = set(self.CCU.iloc[:, 0].tolist()) elif index == 2: equipments = set(self.OR.iloc[:, 0].tolist()) elif index == 3: equipments = set(self.out_patient.iloc[:, 0].tolist()) else: equipments = [] self.set_equipment_menu(equipments) def set_equipment_menu(self, equipments): self.ui.equipment.clear() self.ui.equipment.addItem('Equipment') self.ui.equipment.addItems(equipments) def set_serial_num_menu(self, equip): department_index = self.ui.dep.currentIndex() indices = [] serial_nums = [] if department_index == 1: for i in range(len(self.CCU)): if equip == self.CCU.iloc[i, 0]: indices.append(i) serial_nums.append(self.CCU.iloc[i]['Serial Number']) elif department_index == 2: for i in range(len(self.OR)): if equip == self.OR.iloc[i, 0]: indices.append(i) serial_nums.append(self.OR.iloc[i]['Serial Number']) elif department_index == 3: for i in range(len(self.out_patient)): if equip == self.out_patient.iloc[i, 0]: indices.append(i) serial_nums.append( self.out_patient.iloc[i]['Serial Number']) self.ui.serial_num.clear() self.ui.serial_num.addItem('Serial Number') self.ui.serial_num.addItems(serial_nums) def show_report(self, index): if index == 1: report = self.get_preinstallation() pop_win1(report) elif index == 2: report = self.get_daily_inspection() pop_win2(report) elif index == 3: report = self.get_ppm() pop_win3(report) def get_daily_inspection(self): report = {} equipment_name, serial_num, dep, df = self.get_data() if df is not None: report['hospital'] = 'X' report['department'] = dep report['equipment_name'] = equipment_name report['floor'] = df['Floor Number'] report['room'] = str(df['Room']) report['serial'] = serial_num df_daily = pd.read_excel('data/Dialy_inspection.xlsx') report['date'] = df_daily.iloc[1][1:].tolist() for i in range(len(df_daily)): if serial_num == df_daily.iloc[i][0]: data = df_daily.iloc[i] break report['data'] = data[1:].tolist() return report def get_preinstallation(self): report = {} equipment_name, serial_num, dep, df = self.get_data() if df is not None: report['hospital'] = 'X' report['department'] = dep report['equipment_name'] = equipment_name report['floor'] = df['Floor Number'] report['room'] = str(df['Room']) df_preinst = pd.read_excel('data/Pre_installation.xlsx') for i in range(len(df_preinst)): if serial_num == df_preinst.iloc[i][0]: data = df_preinst.iloc[i] break report['data'] = data[1:].tolist() return report def get_ppm(self): report = {} equipment_name, serial_num, dep, df = self.get_data() if df is not None: report['hospital'] = 'X' report['department'] = dep report['equipment_name'] = equipment_name report['floor'] = df['Floor Number'] report['room'] = str(df['Room']) df_ppm = pd.read_excel('data/PPM.xlsx') for i in range(len(df_ppm)): if serial_num == df_ppm.iloc[i][0]: data = df_ppm.iloc[i] break report['data'] = data[1:].tolist() return report def get_data(self): department_index = self.ui.dep.currentIndex() equipment_name = self.ui.equipment.currentText() serial_num = self.ui.serial_num.currentText() if department_index == 1: department = 'CCU' for i in range(len(self.CCU)): if equipment_name == self.CCU.iloc[ i, 0] and serial_num == self.CCU.iloc[i]['Serial Number']: df = self.CCU.iloc[i] elif department_index == 2: department = 'OR' for i in range(len(self.OR)): if equipment_name == self.OR.iloc[ i, 0] and serial_num == self.OR.iloc[i]['Serial Number']: df = self.OR.iloc[i] elif department_index == 3: department = 'OUT_Patient' for i in range(len(self.out_patient)): if equipment_name == self.out_patient.iloc[ i, 0] and serial_num == self.out_patient.iloc[i][ 'Serial Number']: df = self.out_patient.iloc[i] else: df = None return equipment_name, serial_num, department, df