Ejemplo n.º 1
0
    def __init__(self, client):
        QMainWindow.__init__(self)

        # setup ui
        self.setAttribute(Qt.WA_TranslucentBackground)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.ui.bt_send.clicked.connect(self.bt_send_message)
        self.ui.textEdit_message.installEventFilter(self)
        self.ui.textEdit_message.setFocus()

        # declare elements necessary for message list object
        self.client = client
        self.brush = QBrush()
        self.model = QtGui.QStandardItemModel()

        # setup connection info
        self.HOST = '127.0.0.1'
        self.PORT = 60453
        self.ENCODE_FORMAT = "utf-8"
        self.nick = 'nick'

        # create object of Receiver class, connect to messageSignal and run it in separate thread
        self.receiver = Receiver(self.client)
        self.receiver.messageSignal.connect(self.new_message)
        self.thread1 = threading.Thread(target=self.receiver.run)
        self.thread1.start()
Ejemplo n.º 2
0
    def __init__(self):
        
        # Boilerplate PySide6 app constructors
        super(MainWindow, self).__init__()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        # SINGLE tab
        self.ui.roll_btn.pressed.connect(self.clear_roll_output)                # Clears previous result when pressed
        self.ui.roll_btn.released.connect(self.roll_btn)                        # Initiates single roll when released
        self.ui.atk_btn_1.clicked.connect(self.atk_btn_1)                       # Dice button connections...
        self.ui.atk_btn_2.clicked.connect(self.atk_btn_2)
        self.ui.atk_btn_3.clicked.connect(self.atk_btn_3)
        self.ui.def_btn_1.clicked.connect(self.def_btn_1)
        self.ui.def_btn_2.clicked.connect(self.def_btn_2)
        self.atk_list = []                                                      # SINGLE dice container (atk)
        self.def_list = []                                                      # SINGLE dice container (def)

        # ONSLAUGHT tab
        self.ui.onslaught_btn.pressed.connect(self.clear_onslaught_output)      # Clears previous result when pressed
        self.ui.onslaught_btn.released.connect(self.onslaught_btn)              # Initiates onslaught roll when released
        self.ui.atk_army_total.valueChanged.connect(self.atk_available_armies)  # Updates current atk army total
        self.ui.def_army_total.valueChanged.connect(self.def_available_armies)  # Updates current def army total
        self.onslaught_atk_dice = []                                            # ONSLAUGHT dice container (atk)
        self.onslaught_def_dice = []                                            # ONSLAUGHT dice container (def)
        self.atk_total_armies = 0                                               # Current atk army total
        self.def_total_armies = 0                                               # Current def army total
        self.atk_army_losses = 0                                                # Post-ONSLAUGHT atk losses
        self.def_army_losses = 0                                                # Post-ONSLAUGHT def losses
Ejemplo n.º 3
0
    def __init__(self):
        super(MainWindow, self).__init__()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.setWindowTitle("Quiz It!")

        self.ui.tableWidget.setColumnCount(4)
        self.ui.tableWidget.horizontalHeader().setSectionResizeMode(
            QHeaderView.Stretch)

        self.headers = ["Lock", "Question", "Answer", "Category", "No.", "ID"]

        self.ui.tableWidget.setColumnCount(len(self.headers))

        self.ui.tableWidget.hideColumn(
            self.ui.tableWidget.columnCount() -
            1)  # hide last column, as this is where its id is stored

        self.ui.comboBox.addItems(questions_dao.get_categories())

        self.set_headers()

        self.ui.pushButton.clicked.connect(self.refresh_button)
        self.ui.saveButton.clicked.connect(self.save_button)
        self.ui.openButton.clicked.connect(self.open_button)
Ejemplo n.º 4
0
Archivo: main.py Proyecto: lwwhsh/test2
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        self.monWidget = MonitorWidget(self.ui.widgetMonitor)
        self.roiWidget = RoiWidget(self.ui.widgetROI)
Ejemplo n.º 5
0
    def __init__(self, parent=None):
        super(DoubanPic, self).__init__(parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.douban = DoubanBackend(self)

        self.ui.btn_download.clicked.connect(self.get_pic)
        self.ui.ipt_address.returnPressed.connect(self.get_pic)
Ejemplo n.º 6
0
    def __init__(self, *args, **kwargs):
        super(Window, self).__init__(*args, **kwargs)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.currentItemsSB = [] # Used to store variables to be displayed in status bar at the bottom right
        self.verbose = True # Initialization. Used in the thread generated in application

        self.fs = 10;
        self.N = 50;
        self.dt = 1.0/self.fs
        self.sample_time = self.N*self.dt
        self.data = []
        
        self.R01 = 10000
        self.R02 = 10000
        self.R1 = 10000
        self.R2 = 10000
        
        self.K1 = 3950
        self.K2 = 3950
        
        self.delay = 0
        
        self.calibrateButton = QPushButton()
        # self.calibrateButton.setMinimumSize(QSize(0, 0))
        # self.calibrateButton.setMaximumSize(QSize(88, 21))
        self.calibrateButton.setObjectName("calibrateButton")
        self.ui.gridLayout.addWidget(self.calibrateButton, 4, 0, 1, 2)
        self.calibrateButton.setText("Calibrate!")
        
        self.setStyleSheet(qdarkstyle.load_stylesheet())
        self.getLogo()
        self.getFonts()
        self.initalConnections()
        # self.initialGraphSettings()
        self.arduinoStatusLed()
        # self.initialTimer()
        # self.initialState()
        
        # self.ui.graphWidgetOutput.setLabel('left',"<span style=\"color:white;font-size:16px\">Speed (m/s)</span>")
        # self.ui.graphWidgetOutput.setLabel('bottom',"<span style=\"color:white;font-size:16px\">Time (s)</span>")
        # self.ui.graphWidgetOutput.setTitle("Speed", color="w", size="12pt")

        # self.ui.graphWidgetInput.setLabel('left',"<span style=\"color:white;font-size:16px\">°C</span>")
        # self.ui.graphWidgetInput.setLabel('bottom',"<span style=\"color:white;font-size:16px\">Time (s)</span>")
        # self.ui.graphWidgetInput.setTitle("Temperature", color="w", size="12pt")
        # # self.currentValueSB(self.course)
        
        # self.course = "Sound"
        self.list_ports()
        self.COM = str(self.com_ports[0])
        self.ui.com_port.addItems(self.com_ports)
        self.ui.com_port.setCurrentIndex(self.com_ports.index(self.COM))
        
        atexit.register(self.closeSerial)
Ejemplo n.º 7
0
    def __init__(self):
        super().__init__()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.selected_project = ""

        self.projects = db.getProjects()
        if self.projects:
            self.populateProjectList(self.projects)
        else:
            pass
Ejemplo n.º 8
0
    def __init__(self, parent=None):
        self.__isDrag = False
        self.__startPos = QtCore.QPoint(0, 0)

        #UI初期化処理
        super(MainWindow, self).__init__()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.ui.menubar.addMenu('File')

        #ディレクトリ関連の処理
        self.ui.listView.clicked.connect(self.nextDir)
Ejemplo n.º 9
0
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.filename = ''
        self.threshold = 0
        self.h_file = h5py.File

        QtCore.QObject.connect(self.ui.pushButton_browse, QtCore.SIGNAL("clicked()"), self.browse)
        QtCore.QObject.connect(self.ui.pushButton_start, QtCore.SIGNAL("clicked()"), self.start)
        QtCore.QObject.connect(self.ui.pushButton_auto_threshold, QtCore.SIGNAL("clicked()"), self.auto_threshold)
        QtCore.QObject.connect(self.ui.comboBox_test_num, QtCore.SIGNAL("currentIndexChanged(const QString&)"), self.test_change)

        self.setWindowIcon(QtGui.QIcon('horsey.ico'))
Ejemplo n.º 10
0
    def __init__(self, parent=None):
        QtWidgets.QWidget.__init__(self, parent)

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

        self.ui.action_New_View.triggered.connect(self.new_view)
        self.ui.action_Tile.triggered.connect(self.tile)
        self.ui.action_Settings.triggered.connect(self.settings)

        self.new_view().showMaximized()

        #self.plot()

        self.loadSettings()
Ejemplo n.º 11
0
 def __init__(self):
     QtGui.QMainWindow.__init__(self)
     self.ui = Ui_MainWindow()
     self.ui.setupUi(self)
     self.ui.pushButton_8.clicked.connect(self.conectar)
     self.ui.pushButton_7.clicked.connect(self.crearMaquina)
     self.ui.pushButton_6.clicked.connect(self.apagarMaquina)
     self.ui.pushButton_5.clicked.connect(self.iniciarMaquina)
     self.ui.pushButton_4.clicked.connect(self.pausarMaquina)
     self.ui.pushButton_3.clicked.connect(self.reanudarMaquina)
     self.ui.pushButton_2.clicked.connect(self.reiniciarMaquina)
     self.ui.pushButton_9.clicked.connect(self.borrarMaquina)
     self.ui.pushButton.clicked.connect(self.mostrarMaquinas)
     self.listView = QtGui.QListView()
     self.listWidget = QtGui.QListWidget()
 def __init__(self):
     super(MainWindow, self).__init__()
     self.ui = Ui_MainWindow()
     self.ui.setupUi(self)
     self.available_layout_elements = []
     self.init_ui()
     self.template = LayoutTemplate(self.ui)
     self.config = Config()
     if c.CONFIG_USER_LAST_TEMPLATE_FILE in self.config.user_config:
         template_file = self.config.user_config[
             c.CONFIG_USER_LAST_TEMPLATE_FILE]
         if os.path.exists(template_file):
             self.current_file = template_file
             self.template.load_template(template_file)
             self.change_title()
     self.show()
Ejemplo n.º 13
0
    def __init__(self):
        QMainWindow.__init__(self)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        self.current_directory = str(pathlib.Path(__file__).parent.absolute())
        self.set_image_attribute()

        # set clicked
        self.ui.btnPlay.clicked.connect(self.playAzan)
        self.ui.btnStop.clicked.connect(self.stopAzan)
        # self.ui.btnHide.clicked.connect(self.openSetting)
        self.ui.btnHide.clicked.connect(self.hide)
        self.ui.btnExit.clicked.connect(self.exit)
        self.ui.btnSave.clicked.connect(self.do_save)
        self.ui.btnSetting.clicked.connect(self.show_frame_setting)
        self.ui.btnTimeTable.clicked.connect(self.show_time_table)

        # init form setting
        self.ui.frameSetting.setVisible(False)

        # get username of this login user
        self.myusername = pwd.getpwuid(os.getuid()).pw_name

        # get time
        self.init_times()

        # init thread
        self.docalc = threading.Thread(
            target=self.do_calculate, name="Azan Calculating")

        # init icon
        self.setting_file = self.current_directory + '/setting.txt'
        self.icopath = self.current_directory + '/icon/masjid.xpm'
        self.setWindowIcon(QIcon(self.icopath))
        self.default_azan = self.current_directory + '/audio/azan.mp3'

        # open setting
        self.openSetting()

        # show times
        self.showTimes()

        # show tray on start
        self.show_tray()
Ejemplo n.º 14
0
 def __init__(self, parent = None):
     super(MainWindow, self).__init__(parent)
     self.ui = Ui_MainWindow()
     self.ui.setupUi(self)
     self.ui.listSearch.setVisible(False)
     self.ui.scrollResult.setVisible(False)
     self.connect(self.ui.actionAbout  , QtCore.SIGNAL('triggered()')                      , self.actionAbout_triggered    )
     self.connect(self.ui.actionQuit   , QtCore.SIGNAL('triggered()')                      , QtCore.SLOT('close()')        )
     self.connect(self.ui.editSearch   , QtCore.SIGNAL('textChanged(QString)')             , self.editSearch_textChanged   )
     self.connect(self.ui.buttonSearch , QtCore.SIGNAL('clicked()')                        , self.buttonSearch_clicked     )
     self.connect(self.ui.editSearch   , QtCore.SIGNAL('returnPressed()')                  , self.buttonSearch_clicked     )
     self.connect(self.ui.listSearch   , QtCore.SIGNAL('itemActivated(QListWidgetItem *)') , self.listSearch_itemActivated )
     self.connect(self.ui.buttonPlayA  , QtCore.SIGNAL('clicked()')                        , self.buttonPlayA_clicked      )
     self.connect(self.ui.buttonPlayB  , QtCore.SIGNAL('clicked()')                        , self.buttonPlayB_clicked      )
     self.connect(self.ui.buttonCueA   , QtCore.SIGNAL('clicked()')                        , self.buttonCueA_clicked       )
     self.connect(self.ui.buttonCueB   , QtCore.SIGNAL('clicked()')                        , self.buttonCueB_clicked       )
     self.connect(self.ui.listA        , QtCore.SIGNAL('itemActivated(QListWidgetItem *)') , self.listA_itemActivated      )
     self.connect(self.ui.listB        , QtCore.SIGNAL('itemActivated(QListWidgetItem *)') , self.listB_itemActivated      )
     for i in range(0, SEARCHRESULTS):
         self.resultWidgets.append( WidgetResult(self.ui.scrollResultContents, self.ui.listA, self.ui.listB) )
         self.resultWidgets[i].setGeometry(QtCore.QRect(0, i * self.resultWidgets[i].height(), self.resultWidgets[i].width(), self.resultWidgets[i].height()));
         self.resultWidgets[i].setObjectName( "result" + str(i) )
Ejemplo n.º 15
0
    def __init__(self):
        super().__init__()

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

        self.setWindowTitle('Watlow EZ-Zone PM3 Temperature Control')
        # Icon from: https://icons8.com/icons/set/temperature
        self.setWindowIcon(QIcon(':icon.ico'))

        # Tab and Widget Setup
        self.controlTabWidget = ControlTabWidget()
        self.configTabWidget = ConfigTabWidget()
        self.ui.tabWidget.insertTab(0, self.controlTabWidget, 'Control')
        self.ui.tabWidget.insertTab(1, self.configTabWidget, 'Config')
        #self.ui.tabWidget.insertTab(1, self.massSpecWidget, 'Mass Spec Plot')

        self.configTabWidget.fnameEmitted.connect(
            self.controlTabWidget.parseConfigFile)
        self.controlTabWidget.statusEmitted.connect(self._displayStatus)
        self.configTabWidget.tabIndexEmitted.connect(self._changeTab)
        self.configTabWidget.manualAddEmitted.connect(
            self.controlTabWidget.handleManualAdd)
Ejemplo n.º 16
0
    def __init__(self):
        super(Appwin, self).__init__()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.setMinimumWidth(resolution.width() / 3.0)
        self.setMinimumHeight(resolution.height() / 1.5)
        self.config = util.import_yaml(
            os.path.join(os.getcwd(), 'config', 'config.yml'))

        root = self.config['dataset']['path']
        print(util.check_VOC(root))
        self.data, self.category_index = util.Read_VOC(self.config)
        # print(self.data)
        self.config_update()
        self.ui.tableView.clicked.connect(self.table_clicked)
        self.threadpool = QThreadPool()
        print("Multithreading with maximum %d threads" %
              self.threadpool.maxThreadCount())

        self.ui.btn_filter.clicked.connect(self.btn_filter)
        self.ui.btn_gen_text.clicked.connect(self.btn_gen_text)
        self.ui.btn_create_dataloader_torch.clicked.connect(
            self.btn_torch_data_loader)
Ejemplo n.º 17
0
    def __init__(self):
        QMainWindow.__init__(self)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        if os.name == 'nt':
            self.current_directory = str(
                pathlib.Path(__file__).parent.absolute()).replace('\\', '/')
        else:
            self.current_directory = str(
                pathlib.Path(__file__).parent.absolute())

        self.reformat_ui()

        # set clicked
        self.ui.btnPlay.clicked.connect(self.playAzan)
        self.ui.btnStop.clicked.connect(self.stopAzan)
        # self.ui.btnHide.clicked.connect(self.openSetting)
        self.ui.btnHide.clicked.connect(self.hide)
        self.ui.btnExit.clicked.connect(self.do_close)
        self.ui.btnSave.clicked.connect(self.do_save)
        self.ui.btnSetting.clicked.connect(self.show_frame_setting)
        self.ui.btnTimeTable.clicked.connect(self.show_time_table)
        self.ui.ckNotification.toggled.connect(self.toggle_check_notification)

        self.calculation_method_array = [
            'MWL', 'ISNA', 'Egypt', 'Makkah', 'Karachi', 'Tehran', 'Jafari'
        ]
        self.mathhab_array = ['Standard', 'Hanafi']

        # init form setting
        self.ui.frameSetting.setVisible(False)

        # get username of this login user
        # self.myusername = pwd.getpwuid(os.getuid()).pw_name

        # init icon
        self.setting_file = self.current_directory + '/setting.txt'
        self.icopath = self.current_directory + '/icon/masjid.xpm'
        self.setWindowIcon(QIcon(self.icopath))
        self.default_azan = self.current_directory + '/audio/azan.mp3'
        self.default_azan_wav = self.current_directory + '/audio/azan.wav'
        self.default_notif = self.current_directory + '/audio/hayyalashala.mp3'
        self.default_notif_wav = self.current_directory + '/audio/hayyalashala.wav'

        # image dialog
        azandialog = QDialog(self, Qt.FramelessWindowHint)
        azandialog.setWindowTitle("It's time to Shalat")
        self.azanDialog = azandialog
        btnDialog = QPushButton("", self.azanDialog)
        btnDialog.setFlat(True)
        btnDialog.clicked.connect(self.azanDialog.hide)

        # OPEN SETTING ON START
        self.open_setting()

        # init thread
        self.docalc = threading.Thread(target=self.do_calculate,
                                       name="Azan Calculating")
        self.threadAzan = threading.Thread(target=self._playAzan,
                                           name="Play Azan")
        self.threadNotif = threading.Thread(target=self._playNotif,
                                            name="Play Notif")

        self.init_times_new()

        # show times
        self.showTimes()

        # show tray on start
        self.show_tray()
Ejemplo n.º 18
0
    def __init__(self):
        # Store the username of logged in user
        self.currentLoggedIn = ""

        # Used to build table from sql data
        self.tableData = []
        self.rows = 0
        self.columns = 0

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

        # Start by showing the log in screen
        self.ui.stackedWidget.setCurrentWidget(self.ui.loginPage)

        # NAVIGATION BUTTONS:

        # Log in when we press log in button
        self.ui.loginButton.clicked.connect(self.tryLoggin)

        # Log out when we press log out button
        self.ui.logoutButton.clicked.connect(self.logOut)
        self.ui.logoutButton_2.clicked.connect(self.logOut)

        # Buttons that navigate to dashboard
        self.ui.dashboardButton.clicked.connect(self.navigateDashboard)
        self.ui.dashboardButton_2.clicked.connect(self.navigateDashboard)
        self.ui.backButton.clicked.connect(self.navigateDashboard)
        self.ui.createBugBack.clicked.connect(self.navigateDashboard)
        self.ui.returnFromUserToDashboard.clicked.connect(
            self.navigateDashboard)
        self.ui.returnToDashboard.clicked.connect(self.navigateViewBugs)

        # Buttons that navigate to viewBugsPage
        self.ui.viewBugsButton.clicked.connect(self.navigateViewBugs)
        self.ui.viewBugsButton_2.clicked.connect(self.navigateViewBugs)

        # Buttons that navigate to createBug page
        self.ui.createBugButton.clicked.connect(self.navigateCreateBugs)
        self.ui.createBugButton_2.clicked.connect(self.navigateCreateBugs)
        self.ui.addBugButton.clicked.connect(self.navigateCreateBugs)

        # Buttons that navigate to editBugStatus page
        self.ui.editBugStatus.clicked.connect(self.navigateEditStatusPage)

        # Buttons that navigate to User page
        self.ui.userButton.clicked.connect(self.navigateUserPage)
        self.ui.userButton_2.clicked.connect(self.navigateUserPage)

        # ACTION BUTTONS:

        # Buttons that loads data from sql database (uncompleted or completed bugs)
        self.ui.loadTableButton.clicked.connect(self.loadUncomplete)
        self.ui.loadCompleteTable.clicked.connect(self.loadComplete)

        # Buttons that submits/creates new bug
        self.ui.createBugSubmit.clicked.connect(self.addBugToDB)
        self.ui.createBugSubmit.clicked.connect(self.navigateDashboard)

        # Buttons that marks bug as complete
        self.ui.markBugAsComplete.clicked.connect(self.bugCompleted)
        self.ui.markBugAsComplete.clicked.connect(self.navigateViewBugs)
        self.ui.markBugAsComplete.clicked.connect(self.loadUncomplete)

        # Buttons that deletes bug from database
        self.ui.deleteBugFromDatabase.clicked.connect(self.bugDelete)
        self.ui.deleteBugFromDatabase.clicked.connect(self.navigateViewBugs)
        self.ui.deleteBugFromDatabase.clicked.connect(self.loadUncomplete)

        # Buttons that adds new user to database
        self.ui.submitNewUser.clicked.connect(self.addUserToDb)
        self.ui.submitNewUser.clicked.connect(self.navigateDashboard)

        # Buttons that removes user from database
        self.ui.deleteUserButton.clicked.connect(self.removeUserFromDb)
        self.ui.deleteUserButton.clicked.connect(self.navigateDashboard)
Ejemplo n.º 19
0
class MainWindow(QtWidgets.QMainWindow):
    ui = Ui_MainWindow()
    FILEDATA = FileData()
    about_page = None
    action_dialog = None

    app_version = app.build_settings['version']
    main_icon = app.get_resource('icon.png')

    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        self.setWindowTitle("File to Dir")
        self.ui.setupUi(self, CustomLabel)
        self.setIcons()
        self.set_menu_toolbar_button_action()
        self.reset_all()
    
    def setIcons(self):
        icon = QtGui.QIcon(app.get_resource('reset.png'))
        self.ui.actionReset.setIcon(icon)
        self.ui.actionReset_1.setIcon(icon)
        icon = QtGui.QIcon(app.get_resource('exit.png'))
        self.ui.actionExit.setIcon(icon)
        self.ui.actionExit_1.setIcon(icon)
        icon = QtGui.QIcon(app.get_resource('plus.png'))
        self.ui.actionAdd.setIcon(icon)
        self.ui.actionAdd_1.setIcon(icon)
        icon = QtGui.QIcon(app.get_resource('clear.png'))
        self.ui.actionClear.setIcon(icon)
        self.ui.actionClear_1.setIcon(icon)
        self.ui.actionAdd_Multiple_Folder.setIcon(QtGui.QIcon(app.get_resource('add.png')))
        self.ui.actionAbout_the_Author.setIcon(QtGui.QIcon(self.main_icon))

    def set_menu_toolbar_button_action(self):
        # menu
        self.ui.actionAbout_the_Author.triggered.connect(self.see_about)
        self.ui.actionExit_1.triggered.connect(lambda: sys.exit(0))
        self.ui.actionAdd_1.triggered.connect(self.select_folder)
        self.ui.actionAdd_Multiple_Folder.triggered.connect(lambda: self.select_folder(multiple=True))
        self.ui.actionClear.triggered.connect(self.clear_all_folders)
        self.ui.actionReset.triggered.connect(self.reset_all)

        # toolbar
        self.ui.actionAdd.triggered.connect(self.select_folder)
        self.ui.actionClear.triggered.connect(self.clear_all_folders)
        self.ui.actionReset.triggered.connect(self.reset_all)
        self.ui.actionExit.triggered.connect(sys.exit)

        # button
        self.ui.output_bt.clicked.connect(self.select_output_folder)
        self.ui.bt_go.clicked.connect(self.start_action_dialog)

    def select_folder(self, multiple=False, drag=False, folders=None):
        if multiple:
            file_dialog = QtWidgets.QFileDialog(directory=self.last_selected_dir)
            file_dialog.setFileMode(QtWidgets.QFileDialog.DirectoryOnly)
            file_dialog.setOption(QtWidgets.QFileDialog.DontUseNativeDialog, True)
            file_dialog.setWindowTitle("Select Folders")
            file_dialog.setWindowIcon(QtGui.QIcon(self.main_icon))
            f_tree_view = file_dialog.findChild(QtWidgets.QTreeView)
            if f_tree_view:
                f_tree_view.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection)
            if not file_dialog.exec():
                return
            folders = file_dialog.selectedFiles()
        elif drag:
            folders = [f for f in folders if is_valid_dir(f)]
        else:
            folder = str(QtWidgets.QFileDialog.getExistingDirectory(self, "Select Directory", directory=self.last_selected_dir))
            if folder == '':
                return
            folder = str(Path(folder))
            self.last_selected_dir = join(*folder.split('\\')[:len(folder.split('\\'))-1])
            folders = [folder]
        self.FILEDATA.select_dirs(folders)
        self.ui.txt_stat.setText(self.FILEDATA.get_status_txt())

    def clear_all_folders(self):
        self.FILEDATA.reset()
        self.ui.txt_stat.setText(self.FILEDATA.get_status_txt())

    def select_output_folder(self):
        folder = str(QtWidgets.QFileDialog.getExistingDirectory(self, "Select Output Directory", directory=self.last_selected_out_dir))
        if folder != '':
            folder = str(Path(folder))
            self.last_selected_out_dir = join(*folder.split('\\')[:len(folder.split('\\'))-1])
            self.ui.input_2.setText(folder)

    def reset_all(self):
        self.last_selected_dir = 'C:'
        self.last_selected_out_dir = 'C:'
        self.ui.side_input_2.setChecked(False)
        self.ui.side_input_3.setChecked(False)
        self.ui.side_input_4.setText('')
        self.ui.side_input_5.setText('')
        self.ui.side_input_6.setText('')
        self.ui.side_input_7.setText('')
        self.ui.side_input_8.setChecked(False)
        self.ui.side_input_9.setChecked(False)
        self.ui.side_input_10.setText('')
        self.ui.side_input_11.setText('')
        self.ui.side_input_12.setText('')
        self.ui.side_input_13.setText('')
        self.ui.input_1.setCurrentIndex(0)
        self.ui.input_2.setText('')
        self.clear_all_folders()

    def see_about(self):
        if self.about_page is None:
            self.about_page = QtWidgets.QWidget()
            self.about_page.ui = Ui_AboutPage()
            self.about_page.ui.setupUi(self.about_page)
            self.about_page.ui.version.setText(f'v{self.app_version}')
            self.about_page.ui.icon.setPixmap(QtGui.QPixmap(self.main_icon))
            self.about_page.ui.name.setText("File To Dir")
        self.about_page.destroy()
        self.about_page.show()

    def go_for_work(self):
        self.action_dialog.ui.pushButton_start.setEnabled(False)
        self.action_dialog.ui.pushButton_cancel.setEnabled(False)
        self.action_dialog.ui.pushButton_finish.setEnabled(False)
        
        self.action_dialog.ui.stackedWidget.setCurrentIndex(0)
        
        self.action_dialog.ui.progressBar.setMaximum(get_file_count(self.action_dialog.data_folders) or 1)

        self.thread = actionThread(self.action_dialog.data_action, self.action_dialog.data_folders, self.action_dialog.data_data, self.action_dialog.data_des)
        self.thread.finished.connect(self.on_action_finish)
        self.thread.updateSignal.connect(self.on_action_update)
        self.thread.startActionSignal.connect(self.on_action_update_2)
        
        self.thread.start()

    def start_action_dialog(self):
        i1 = self.ui.input_1.currentIndex()
        i2 = self.ui.input_2.text()
        include_subfolder = self.ui.side_input_1.isChecked()
        if i2.strip() == '':
            return QtWidgets.QMessageBox.warning(self, "Warning", f"<p style=\"font-size: 10pt;\"><b>Error Found.</b> Please, give Output Directory.</p>")
        i2 = Path(i2)
        if not (i2.exists() and i2.is_dir()):
            return QtWidgets.QMessageBox.warning(self, "Warning", f"<p style=\"font-size: 10pt;\"><b>Error Found.</b> Output Directory not exist.</p>")
        i2 = str(i2)
        
        folders = self.FILEDATA.get_all_folders(include_subfolder)

        data = {
            's2': self.ui.side_input_2.isChecked(),
            's3': self.ui.side_input_3.isChecked(),
            's4': self.ui.side_input_4.text(),
            's5': self.ui.side_input_5.text(),
            's6': self.ui.side_input_6.text(),
            's7': self.ui.side_input_7.text(),
            's8': self.ui.side_input_8.isChecked(),
            's9': self.ui.side_input_9.isChecked(),
            's10': self.ui.side_input_10.text(),
            's11': self.ui.side_input_11.text(),
            's12': self.ui.side_input_12.text(),
            's13': self.ui.side_input_13.text(),
        }

        if self.action_dialog == None:
            self.action_dialog = QtWidgets.QWidget()
            self.action_dialog.setWindowTitle("Action")
            self.action_dialog.ui = Ui_ActionDialog()
            self.action_dialog.ui.setupUi(self.action_dialog)
            self.action_dialog.setFixedHeight(223)
            self.action_dialog.setFixedWidth(515)
            self.action_dialog.ui.progressBar.setMinimum(0)
            self.action_dialog.ui.pushButton_start.clicked.connect(self.go_for_work)
            self.action_dialog.ui.pushButton_cancel.clicked.connect(self.action_dialog.close)
            self.action_dialog.ui.pushButton_finish.clicked.connect(self.action_dialog.close)
        
        self.action_dialog.ui.pushButton_start.setEnabled(True)
        self.action_dialog.ui.pushButton_cancel.setEnabled(True)
        self.action_dialog.ui.pushButton_finish.setEnabled(False)

        self.action_dialog.ui.label_desDir.setText(get_prefferd_text(i2))
        action = 'Copying :'
        action_ = 'Copied'
        if i1 == 1:
            action = 'Moving :'
            action_ = 'Moved'
        self.action_dialog.ui.label_action_going.setText(action)
        self.action_dialog.ui.label_action.setText(action_)
        self.action_dialog.ui.stackedWidget.setCurrentIndex(1)
        self.action_dialog.ui.label_statBar.setText("""<html><body><p align="center"><span style="font-size:18pt;">Click 'Start' to go</span></p></body></html>""")
        
        self.action_dialog.ui.label_done.setText("0")
        self.action_dialog.ui.label_failed.setText("0")
        self.action_dialog.ui.label_notAllowed.setText("0")
        self.action_dialog.ui.label_ignored.setText("0")

        self.action_dialog.ui.progressBar.setValue(0)

        self.action_dialog.data_data = data
        self.action_dialog.data_folders = folders
        self.action_dialog.data_action = i1
        self.action_dialog.data_des = i2
        self.action_dialog.action_done = 0

        self.action_dialog.destroy()
        self.action_dialog.show()

    def on_action_update(self, done, fail, not_allowed, ignored):
        self.action_dialog.ui.label_done.setText(str(done))
        self.action_dialog.ui.label_failed.setText(str(fail))
        self.action_dialog.ui.label_notAllowed.setText(str(not_allowed))
        self.action_dialog.ui.label_ignored.setText(str(ignored))

        self.action_dialog.action_done += 1
        self.action_dialog.ui.progressBar.setValue(self.action_dialog.action_done)

    def on_action_finish(self):
        self.action_dialog.ui.pushButton_start.setEnabled(False)
        self.action_dialog.ui.pushButton_cancel.setEnabled(False)
        self.action_dialog.ui.pushButton_finish.setEnabled(True)

        self.action_dialog.ui.progressBar.setMaximum(100)
        self.action_dialog.ui.progressBar.setValue(100)

        self.action_dialog.ui.stackedWidget.setCurrentIndex(1)

        self.action_dialog.ui.label_statBar.setText("""<html><body><p align="center"><span style="font-size:18pt;">Finished</span></p></body></html>""")
    
    def on_action_update_2(self, folder, file):
        self.action_dialog.ui.label_fromDir.setText(get_prefferd_text(folder))
        self.action_dialog.ui.label_file.setText(get_prefferd_text(file))
Ejemplo n.º 20
0
from PyQt5.QtCore import pyqtSignal, pyqtProperty, Qt
from PyQt5.QtGui import QColor
from threading import Thread
from concurrent.futures import ThreadPoolExecutor
import pyttsx3


class MainWindow(QMainWindow):
    loadFileSignal = pyqtSignal(object)


app = QApplication(sys.argv)
loop = QEventLoop(app)
asyncio.set_event_loop(loop)
win = MainWindow()
ui = Ui_MainWindow()
ui.setupUi(win)
xd = Xdo()
keyboard = Controller()
fileObserver = Observer()

voices = [
    "m1",
    "f1",
    "m4",
    "m7",
    "f5",
    "croak",
    "klatt1",
    "klatt4",
    "whisper",
Ejemplo n.º 21
0
    def __init__(self):
        super().__init__()
        self.ui = Ui_MainWindow(self)

        self.homeTab = HomeTabUI(self.ui.tab1)
        self.registration = RegistrationUI(self.ui.tab2)
        self.profile = ProfileUI(self.ui.tab3)

        self.connection = create_connection("localhost", "root", "",
                                            "ofwtmc_db")
        select_members = "SELECT id, mem_name, mem_address, contact_no FROM members"
        self.members_data = execute_read_query(self.connection, select_members)

        self.getMembersData()

        self.right = self.ui.tabWidget.tabBar().RightSide

        self.save_registration_tab = self.ui.tabWidget.widget(
            1)  # save it for later
        self.save_profile_tab = self.ui.tabWidget.widget(
            2)  # save Member Profile Tab for later
        self.removeRegistrationTab()
        self.removeMemberProfileTab()

        # Create actionsDict
        actionsDict = {
            self.ui.menuHome: "Home",
            self.ui.actionNew: "New",
            self.ui.actionSave: "Save",
            self.ui.actionCut: "Cut",
            self.ui.actionCopy: "Copy",
            self.ui.actionPaste: "Paste",
            self.ui.actionPreview: "Preview"
        }

        self.childrenData = []

        self.id = self.profile.inputId

        self.date = self.registration.dateInput
        self.id_picture = self.registration.filenameText
        self.ofw_name = self.registration.ofwNameInput
        self.ofw_address = self.registration.ofwAddressInput
        self.b_name = self.registration.beneficiaryNameInput
        self.b_address = self.registration.beneficiaryAddresInput
        self.pob = self.registration.placeOfBirthInput
        self.province_add = self.registration.provincialAddressInput
        self.religion = self.registration.religionInput
        self.contact_no = self.registration.contactInput
        self.email = self.registration.emailAddInput
        self.age = self.registration.ageInput
        self.status = self.registration.civilStatusInput
        self.citizenship = self.registration.citizenshipInput
        self.tin = self.registration.tinInput
        self.sss = self.registration.sssInput
        self.hw_name = self.registration.hwNameInput
        self.hw_pob = self.registration.hwPlaceOfBirthInput
        self.hw_occupation = self.registration.hwOccupationInput
        self.hw_dob = self.registration.hwDateOfBirthInput
        self.hw_age = self.registration.hwAgeInput
        self.emp_name = self.registration.empNameInput
        self.emp_position = self.registration.empPositionInput
        self.emp_address = self.registration.empAddressInput
        self.emp_date = self.registration.empDateInput
        self.emp_cn = self.registration.empContactInput
        self.emp_email = self.registration.empEmailInput
        self.incase_name = self.registration.incaseNameInput
        self.incase_contact = self.registration.incaseContactInput
        self.incase_address = self.registration.incaseContactInput
        self.dob = self.registration.dateOfBirthInput
        self.op_dr_name = self.registration.opOrDriverInput

        self.sex = self.getSRBtn()
        self.ch1_name, self.ch1_address, self.ch1_age = self.getChildData(0)
        self.ch2_name, self.ch2_address, self.ch2_age = self.getChildData(1)
        self.ch3_name, self.ch3_address, self.ch3_age = self.getChildData(2)

        #self.registration_inputs = {self.date, self.id_picture, self.ofw_address, self.b_name,
        #                                self.b_address, self.pob, self.province_add, self.religion,
        #                               self.contact_no, self.email, self.age, self.status,
        #                               self.hw_name, self.hw_pob, self.hw_dob, self.hw_age, self.hw_occupation,
        #                              self.emp_name, self.emp_position, self.emp_address,self.emp_date, self.emp_cn,
        #                              self.emp_email, self.incase_name, self.incase_address, self.incase_contact,
        #                            self.op_dr_name, self.id_picture}

        # Iterate on actionsDict.items then call updateClick
        for action, actionName in actionsDict.items():
            self.updateClick(action, actionName)

        # Call the openFileNameDialog when fileSelectBtn is clicked
        self.registration.fileSelectBtn.clicked.connect(
            self.openFileNameDialog)

        # Call the uploadBtnClicked when uploadBtn is clicked
        self.registration.uploadBtn.clicked.connect(self.uploadBtnClicked)

        self.registration.submitBtn.clicked.connect(self.submitPopup)

        self.registration.msgBox.buttonClicked.connect(self.saveFileDialog)

        self.registration.comboBox.activated.connect(self.comboPressed)

        self.registration.chAddBtn.clicked.connect(self.addChildren)

        self.profile.showBtn.clicked.connect(self.LoadData)

        self.homeTab.register_btn.clicked.connect(self.showRegistration)

        self.homeTab.member_profiles_btn.clicked.connect(
            self.showMemberProfile)

        self.homeTab.listwidget.itemClicked.connect(self.LoadData)

        self.homeTab.search_input.textChanged.connect(self.inputChecker)

        self.homeTab.comboBox.currentTextChanged.connect(self.getMembersData)
Ejemplo n.º 22
0
class MainWindow(QtWidgets.QMainWindow):
    app_version = app.build_settings['version']
    main_icon = app.get_resource('icon.png')
    ui = Ui_MainWindow()
    FILEDATA = FileData()

    last_selected_dir = 'C:'

    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        self.ui.setupUi(self, CustomLabel)
        self.setWindowTitle("NW File Renamer")
        self.about_page = None
        self.dialog = None
        self.rename_ui = None
        self.setIcons(ic1=app.get_resource('plus.png'),
                      ic2=app.get_resource('add.png'),
                      ic3=app.get_resource('clear.png'),
                      ic4=app.get_resource('reset.png'),
                      ic5=app.get_resource('exit.png'))
        self.set_menu_toolbar_button_action()
        self.set_mainpage_buttons()
        self.ui.txt_stat.setText(self.FILEDATA.get_status_txt())

    def setIcons(self, **arg):
        icon = QtGui.QIcon(arg.get('ic4', ''))
        self.ui.bt_reset_1.setIcon(icon)
        self.ui.bt_reset_2.setIcon(icon)
        self.ui.bt_reset_3.setIcon(icon)
        self.ui.bt_reset_4.setIcon(icon)
        self.ui.actionReset.setIcon(icon)
        self.ui.actionReset_1.setIcon(icon)
        icon = QtGui.QIcon(arg.get('ic5', ''))
        self.ui.actionExit.setIcon(icon)
        self.ui.actionExit_1.setIcon(icon)
        icon = QtGui.QIcon(arg.get('ic1', ''))
        self.ui.actionAdd.setIcon(icon)
        self.ui.actionAdd_1.setIcon(icon)
        icon = QtGui.QIcon(arg.get('ic3', ''))
        self.ui.actionClear.setIcon(icon)
        self.ui.actionClear_1.setIcon(icon)
        self.ui.actionAdd_Multiple_Folder.setIcon(
            QtGui.QIcon(arg.get('ic2', '')))
        self.ui.actionAbout_the_Author.setIcon(QtGui.QIcon(self.main_icon))

    def set_menu_toolbar_button_action(self):
        # menu
        self.ui.actionAbout_the_Author.triggered.connect(
            lambda: self.see_about())
        self.ui.actionExit_1.triggered.connect(lambda: sys.exit(0))
        self.ui.actionAdd_1.triggered.connect(lambda: self.select_folder())
        self.ui.actionAdd_Multiple_Folder.triggered.connect(
            lambda: self.select_folder(multiple=True))
        self.ui.actionClear.triggered.connect(lambda: self.clear_all_folders())
        self.ui.actionReset.triggered.connect(lambda: self.reset_all())

        # toolbar
        self.ui.actionAdd.triggered.connect(lambda: self.select_folder())
        self.ui.actionClear.triggered.connect(lambda: self.clear_all_folders())
        self.ui.actionReset.triggered.connect(lambda: self.reset_all())
        self.ui.actionExit.triggered.connect(lambda: sys.exit(0))

        # sidebar
        self.ui.bt_main_menu.clicked.connect(
            lambda: self.ui.stackedWidget.setCurrentIndex(0))

        # mainbar main page
        self.ui.bt_menu_1.clicked.connect(
            lambda: self.ui.stackedWidget.setCurrentIndex(1))
        self.ui.bt_menu_2.clicked.connect(
            lambda: self.ui.stackedWidget.setCurrentIndex(2))
        self.ui.bt_menu_3.clicked.connect(
            lambda: self.ui.stackedWidget.setCurrentIndex(3))
        self.ui.bt_menu_4.clicked.connect(
            lambda: self.ui.stackedWidget.setCurrentIndex(4))

    def select_folder(self, multiple=False, drag=False, folders=None):
        if multiple:
            file_dialog = QtWidgets.QFileDialog(
                directory=self.last_selected_dir)
            file_dialog.setFileMode(QtWidgets.QFileDialog.DirectoryOnly)
            file_dialog.setOption(QtWidgets.QFileDialog.DontUseNativeDialog,
                                  True)
            file_dialog.setWindowTitle("Select Folders")
            file_dialog.setWindowIcon(QtGui.QIcon(self.main_icon))
            f_tree_view = file_dialog.findChild(QtWidgets.QTreeView)
            if f_tree_view:
                f_tree_view.setSelectionMode(
                    QtWidgets.QAbstractItemView.MultiSelection)
            if not file_dialog.exec():
                return
            folders = file_dialog.selectedFiles()
        elif drag:
            folders = [f for f in folders if is_valid_dir(f)]
        else:
            folder = str(
                QtWidgets.QFileDialog.getExistingDirectory(
                    self, "Select Directory",
                    directory=self.last_selected_dir))
            if folder == '':
                return
            folder = str(Path(folder))
            self.last_selected_dir = join(
                *folder.split('\\')[:len(folder.split('\\')) - 1])
            folders = [folder]
        self.FILEDATA.select_dirs(folders)
        self.ui.txt_stat.setText(self.FILEDATA.get_status_txt())

    def clear_all_folders(self):
        self.FILEDATA.reset()
        self.ui.txt_stat.setText(self.FILEDATA.get_status_txt())

    def see_about(self):
        if self.about_page is None:
            self.about_page = QtWidgets.QWidget()
            self.about_page.ui = Ui_AboutPage()
            self.about_page.ui.setupUi(self.about_page)
            self.about_page.ui.version.setText(f'v{self.app_version}')
            self.about_page.ui.icon.setPixmap(QtGui.QPixmap(self.main_icon))
            self.about_page.ui.name.setText("NW File Renamer")
        self.about_page.destroy()
        self.about_page.show()

    def show_help_dialog(self, no):
        if self.dialog is None:
            self.dialog = QtWidgets.QWidget()
            font = QtGui.QFont()
            font.setPointSize(11)
            self.dialog.setFont(font)
            self.dialog.setWindowTitle("Help")
            self.dialog.gridlayout = QtWidgets.QGridLayout(self.dialog)
            self.dialog.main_text = QtWidgets.QTextBrowser(self.dialog)
            self.dialog.gridlayout.addWidget(self.dialog.main_text, 0, 0, 1, 2)
            self.dialog.bt_close = QtWidgets.QPushButton(self.dialog)
            sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed,
                                               QtWidgets.QSizePolicy.Fixed)
            sizePolicy.setHorizontalStretch(0)
            sizePolicy.setVerticalStretch(0)
            sizePolicy.setHeightForWidth(
                self.dialog.bt_close.sizePolicy().hasHeightForWidth())
            self.dialog.bt_close.setSizePolicy(sizePolicy)
            self.dialog.bt_close.setText("Close")
            self.dialog.gridlayout.addWidget(self.dialog.bt_close, 1, 1, 1, 1)
            self.dialog.setWindowIcon(QtGui.QIcon(self.main_icon))
            self.dialog.setWindowModality(QtCore.Qt.ApplicationModal)
            QtWidgets.QShortcut(
                QtGui.QKeySequence('Esc'),
                self.dialog).activated.connect(lambda: self.dialog.close())
            self.dialog.bt_close.clicked.connect(lambda: self.dialog.close())

        if no == 1:
            self.dialog.setFixedWidth(400)
            self.dialog.setFixedHeight(270)
            self.dialog.main_text.setHtml(
                "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
                "p, li { white-space: pre-wrap; }\n"
                "</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:11pt; font-weight:400; font-style:normal;\">\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-size:12pt; font-weight:600; text-decoration: underline;\">You can use these statement in name format :</span></p>\n"
                "<p style=\"-qt-paragraph-type:empty; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Arial'; font-weight:600; text-decoration: underline;\"><br /></p>"
                "<table border=\"0\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px;\" cellspacing=\"2\" cellpadding=\"0\">\n"
                "<tr>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\">&lt;no&gt;</span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\"> : </span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\';\">get file number </span></p></td></tr>\n"
                "<tr>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\">&lt;file&gt;</span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\"> : </span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\';\">get full filename </span></p></td></tr>\n"
                "<tr>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\">&lt;filename&gt;</span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\"> : </span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\';\">get filename without extension </span></p></td></tr>\n"
                "<tr>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\">&lt;ext&gt;</span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\"> : </span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\';\">get file extension </span></p></td></tr>\n"
                "<tr>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\">&lt;c_date&gt;</span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\"> : </span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\';\">get creation date </span></p></td></tr>\n"
                "<tr>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\">&lt;m_date&gt;</span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\"> : </span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\';\">get modification date </span></p></td></tr>\n"
                "<tr>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\">&lt;size&gt;</span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\"> : </span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\';\">get file size </span></p></td></tr>\n"
                "<tr>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\">&lt;sizeb&gt;</span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\"> : </span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\';\">get file size in bytes </span></p></td></tr></table></body></html>"
            )
        elif no == 2:
            self.dialog.setFixedWidth(590)
            self.dialog.setFixedHeight(250)
            self.dialog.main_text.setHtml(
                "<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
                "p, li { white-space: pre-wrap; }\n"
                "</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:11pt; font-weight:400; font-style:normal;\">\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-size:12pt; font-weight:600; text-decoration: underline;\">You can use these statement in date format :</span></p>\n"
                "<p style=\"-qt-paragraph-type:empty; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:\'Arial\'; font-size:12pt; font-weight:600; text-decoration: underline;\"><br /></p>\n"
                "<table border=\"0\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px;\" cellspacing=\"2\" cellpadding=\"0\">\n"
                "<tr>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\">%a</span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\"> : </span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\';\">get short weekday (Sun , Mon)</span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\';\">   |  </span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\">%A</span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\"> : </span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\';\">get full weekday (Sunday , Monday)</span></p></td></tr>\n"
                "<tr>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\">%d</span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\"> : </span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\';\">get day (01, 24)</span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\';\">   |  </span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\">%m</span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\"> : </span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\';\">get month (01, 12)</span></p></td></tr>\n"
                "<tr>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\">%b</span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\"> : </span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\';\">get short month (Jan, Feb)</span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\';\">   |  </span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\">%B</span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\"> : </span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\';\">get full month (January, February)</span></p></td></tr>\n"
                "<tr>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\">%y</span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\"> : </span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\';\">get short year (99, 20)</span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\';\">   |  </span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\">%Y</span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\"> : </span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\';\">get full year(1999, 2020)</span></p></td></tr>\n"
                "<tr>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\">%I</span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\"> : </span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\';\">get Hour 12-hour clock (4, 12)</span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\';\">   |  </span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\">%H</span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\"> : </span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\';\">get Hour 24-hour clock (6, 23)</span></p></td></tr>\n"
                "<tr>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\">%M</span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\"> : </span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\';\">get minute (10, 59)</span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\';\">   |  </span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\">%S</span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\"> : </span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\';\">get second (10, 59)</span></p></td></tr>\n"
                "<tr>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\">%%</span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\'; font-weight:600;\"> : </span></p></td>\n"
                "<td>\n"
                "<p style=\" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'Arial\';\">get \'%\' character</span></p></td>\n"
                "<td></td>\n"
                "<td></td>\n"
                "<td></td>\n"
                "<td></td></tr></table></body></html>")

        self.dialog.destroy()
        self.dialog.show()

    def set_mainpage_buttons(self):
        # mainbar page 1
        self.ui.bt_rename_1.clicked.connect(
            lambda: self.go_for_rename(1,
                                       i1=self.ui.rn_1_input_1.currentIndex(),
                                       i2=self.ui.rn_1_input_2.text()))
        self.ui.bt_reset_1.clicked.connect(lambda: self.reset_page_1())

        def disable_wanted_ext(self, i):
            if i == 2:
                self.ui.widget_1_1.setEnabled(False)
            else:
                self.ui.widget_1_1.setEnabled(True)

        self.ui.rn_1_input_1.currentIndexChanged['int'].connect(
            lambda i: disable_wanted_ext(self, i))

        # mainbar page 2
        self.ui.bt_rename_2.clicked.connect(
            lambda: self.go_for_rename(2,
                                       i1=self.ui.rn_2_input_1.text(),
                                       i2=self.ui.rn_2_input_2.text(),
                                       i3=self.ui.rn_2_input_3.isChecked()))
        self.ui.bt_reset_2.clicked.connect(lambda: self.reset_page_2())

        # mainbar page 3
        self.ui.bt_rename_3.clicked.connect(
            lambda: self.go_for_rename(3,
                                       i1=self.ui.rn_3_input_1.text(),
                                       i2=self.ui.rn_3_input_2.isChecked(),
                                       i3=self.ui.rn_3_input_3.currentIndex(),
                                       i4=self.ui.rn_3_input_4.currentIndex(),
                                       i5=self.ui.rn_3_input_5.text(),
                                       i6=self.ui.rn_3_input_6.text(),
                                       i7=self.ui.rn_3_input_7.isChecked(),
                                       i8=self.ui.rn_3_input_8.text(),
                                       i9=self.ui.rn_3_input_9.text()))
        self.ui.bt_reset_3.clicked.connect(lambda: self.reset_page_3())
        self.ui.bt_help_3_1.clicked.connect(lambda: self.show_help_dialog(1))
        self.ui.bt_help_3_2.clicked.connect(lambda: self.show_help_dialog(2))
        self.ui.bt_help_3_3.clicked.connect(lambda: self.show_help_dialog(2))

        # mainbar page 4
        self.ui.bt_rename_4.clicked.connect(lambda: self.go_for_rename(
            4,
            i1=self.ui.rn_4_input_1.text(),
            i2=self.ui.rn_4_input_2.text(),
            i3=self.ui.rn_4_input_3.isChecked(),
            i4=self.ui.rn_4_input_4.text(),
            i5=self.ui.rn_4_input_5.text(),
            i6=self.ui.rn_4_input_6.text(),
            i7=self.ui.rn_4_input_7.text(),
            i8=self.ui.rn_4_input_8.text(),
            i9=self.ui.rn_4_input_9.text(),
            i10=self.ui.rn_4_input_10.currentIndex(),
            i11=self.ui.rn_4_input_11.text(),
            i12=self.ui.rn_4_input_12.text(),
            i13=self.ui.rn_4_input_13.text(),
            i14=self.ui.rn_4_input_14.text(),
            i15=self.ui.rn_4_input_15.text(),
            i16=self.ui.rn_4_input_16.text(),
            i17=self.ui.rn_4_input_17.currentIndex(),
            i18=self.ui.rn_4_input_18.text(),
            i19=self.ui.rn_4_input_19.text(),
            i20=self.ui.rn_4_input_20.text(),
            i21=self.ui.rn_4_input_21.text(),
            i22=self.ui.rn_4_input_22.text(),
            i23=self.ui.rn_4_input_23.currentIndex()))
        self.ui.bt_reset_4.clicked.connect(lambda: self.reset_page_4())

    def reset_page_1(self):
        self.ui.rn_1_input_1.setCurrentIndex(0)
        self.ui.rn_1_input_2.setText('')

    def reset_page_2(self):
        self.ui.rn_2_input_1.setText("")
        self.ui.rn_2_input_2.setText("")
        self.ui.rn_2_input_3.setChecked(True)

    def reset_page_3(self):
        self.ui.rn_3_input_1.setText("")
        self.ui.rn_3_input_2.setChecked(True)
        self.ui.rn_3_input_3.setCurrentIndex(0)
        self.ui.rn_3_input_4.setCurrentIndex(0)
        self.ui.rn_3_input_5.setText("")
        self.ui.rn_3_input_6.setText("")
        self.ui.rn_3_input_7.setChecked(True)
        self.ui.rn_3_input_8.setText("")
        self.ui.rn_3_input_9.setText("")

    def reset_page_4(self):
        self.ui.rn_4_input_1.setText("")
        self.ui.rn_4_input_2.setText("")
        self.ui.rn_4_input_3.setChecked(True)
        self.ui.rn_4_input_4.setText("")
        self.ui.rn_4_input_5.setText("")
        self.ui.rn_4_input_6.setText("")
        self.ui.rn_4_input_7.setText("")
        self.ui.rn_4_input_8.setText("")
        self.ui.rn_4_input_9.setText("")
        self.ui.rn_4_input_10.setCurrentIndex(0)
        self.ui.rn_4_input_11.setText("")
        self.ui.rn_4_input_12.setText("")
        self.ui.rn_4_input_13.setText("")
        self.ui.rn_4_input_14.setText("")
        self.ui.rn_4_input_15.setText("")
        self.ui.rn_4_input_16.setText("")
        self.ui.rn_4_input_17.setCurrentIndex(0)
        self.ui.rn_4_input_18.setText("")
        self.ui.rn_4_input_19.setText("")
        self.ui.rn_4_input_20.setText("")
        self.ui.rn_4_input_21.setText("")
        self.ui.rn_4_input_22.setText("")
        self.ui.rn_4_input_23.setCurrentIndex(0)

    def reset_all(self):
        self.last_selected_dir = 'C:'
        self.ui.side_input_1.setChecked(False)
        self.ui.side_input_2.setChecked(False)
        self.ui.side_input_3.setChecked(False)
        self.ui.side_input_4.setText("")
        self.ui.side_input_5.setText("")
        self.ui.side_input_6.setText("")
        self.ui.side_input_7.setText("")
        self.ui.side_input_8.setChecked(False)
        self.ui.side_input_9.setChecked(False)
        self.ui.side_input_10.setText("")
        self.ui.side_input_11.setText("")
        self.ui.side_input_12.setText("")
        self.ui.side_input_13.setText("")
        self.reset_page_1()
        self.reset_page_2()
        self.reset_page_3()
        self.reset_page_4()

    def show_message(self, text, title="Warning", subtitle="Error Found."):
        if subtitle:
            subtitle = '<b>' + subtitle + '</b>'
        return QtWidgets.QMessageBox.warning(
            self, "Warning",
            f"<p style=\"font-size: 10pt;\">{subtitle} {text}</p>")

    def go_for_rename(self, code, **arg):
        if code == 1:
            if arg['i1'] != 2:
                if arg['i2'] == '':
                    return self.show_message("Wanted extension is missing!")
                if not is_valid_filename(arg['i2']):
                    return self.show_message("Wanted extension is invalid!")
        elif code == 2:
            if arg['i1'] == '' and arg['i2'] == '':
                return self.show_message(
                    "Both <b>Suffix</b> and <b>Prefix</b> are missing!")
            if not is_valid_filename(arg['i1']):
                return self.show_message("Prefix is invalid!")
            if not is_valid_filename(arg['i2']):
                return self.show_message("Suffix is invalid!")
        elif code == 3:
            if arg['i1'] == '':
                return self.show_message("Name Format is missing!")
            if not is_valid_filename(arg['i1'].replace("<no>", "").replace(
                    "<c_date>", "").replace("<m_date>", "").replace(
                        "<size>", "").replace("<sizeb>", "").replace(
                            "<file>", "").replace("<filename>", "").replace(
                                "<ext>", "")):
                return self.show_message("Name Format is invalid!")
            if not is_valid_filename(arg['i5']):
                return self.show_message("Prefix is invalid!")
            if not is_valid_filename(arg['i6']):
                return self.show_message("Suffix is invalid!")
            if arg['i8'] == "" and "<c_date>" in arg['i1']:
                return self.show_message("Create date format is missing!")
            if arg['i9'] == "" and "<m_date>" in arg['i1']:
                return self.show_message("Modify date format is missing!")
            if not is_valid_date_format(arg['i8']):
                return self.show_message("Create date format is invalid!")
            if not is_valid_date_format(arg['i9']):
                return self.show_message("Modify date format is invalid!")
        elif code == 4:
            if not (arg['i1'] or arg['i2'] or arg['i4'] or arg['i7']
                    or arg['i8'] or arg['i9'] or arg['i11'] or arg['i13']
                    or arg['i14'] or arg['i15'] or arg['i18'] or arg['i20']):
                return self.show_message(
                    "Nothing to do! Please, make any change.")
            if not is_valid_filename(arg['i1']):
                return self.show_message("Prefix is invalid!")
            if not is_valid_filename(arg['i2']):
                return self.show_message("Suffix is invalid!")
            if not arg['i4'] and arg['i5']:
                return self.show_message(
                    "Replace --> Old Field is required to work!")
            if not is_valid_filename(arg['i5']):
                return self.show_message("Replace --> New Field is invalid!")
            if not is_valid_filename(arg['i6']):
                return self.show_message(
                    "Replace Range --> Text Field is invalid!")
            if arg['i7'] or arg['i8']:
                if arg['i7'] and get_int(arg['i7']) is None:
                    return self.show_message(
                        "Replace Range --> Start Index is Invalid!")
                if arg['i8'] and get_int(arg['i8']) is None:
                    return self.show_message(
                        "Replace Range --> End Index is Invalid!")
            if not is_valid_filename(arg['i9']):
                return self.show_message("Remove --> Text Field is invalid!")
            if arg['i11'] and arg['i12']:
                if get_int(arg['i12']) is None:
                    return self.show_message(
                        "Remove --> Number Feild is Invalid!")
                if get_int(arg['i12']) < 0:
                    return self.show_message(
                        "Remove --> Number Feild is cannot be less than 0 !")
            if arg['i13'] or arg['i14']:
                if arg['i13'] and get_int(arg['i13']) is None:
                    return self.show_message(
                        "Remove Range --> Start Index Feild is Invalid!")
                if arg['i14'] and get_int(arg['i14']) is None:
                    return self.show_message(
                        "Remove Range --> End Index Feild is Invalid!")
            if not is_valid_filename(arg['i15']):
                return self.show_message("Add Text --> Text Field is invalid!")
            if arg['i15']:
                if not arg['i16']:
                    return self.show_message(
                        "Add Text --> Index Field is required!")
                if get_int(arg['i16']) is None:
                    return self.show_message(
                        "Add Text --> Index Field is invalid!")
            if not is_valid_filename(arg['i19']):
                return self.show_message("Add Text --> New Field is invalid!")
            if arg['i18'] and not arg['i19']:
                return self.show_message("Add Text --> New Field is required!")
            if not arg['i18'] and arg['i19']:
                return self.show_message("Add Text --> Old Field is required!")
            if not arg['i20'] and (arg['i21'] or arg['i22']):
                return self.show_message(
                    "Transfer Text --> New Position Field is required!")
            if arg['i20']:
                if get_int(arg['i20']) is None:
                    return self.show_message(
                        "Transfer Text --> New Position Field is invalid!")
                if not (arg['i21'] or arg['i22']):
                    return self.show_message(
                        "Transfer Text --> Old Start and End Index Field is required!"
                    )
                if arg['i21'] and get_int(arg['i21']) is None:
                    return self.show_message(
                        "Transfer Text --> Old Start Index Field is invalid!")
                if arg['i22'] and get_int(arg['i22']) is None:
                    return self.show_message(
                        "Transfer Text --> Old End Index Field is invalid!")

            arg['i7'] = get_int(arg['i7'])
            arg['i8'] = get_int(arg['i8'])
            arg['i12'] = get_int(arg['i12'])
            arg['i13'] = get_int(arg['i13'])
            arg['i14'] = get_int(arg['i14'])
            arg['i16'] = get_int(arg['i16'])
            arg['i20'] = get_int(arg['i20'])
            arg['i21'] = get_int(arg['i21'])
            arg['i22'] = get_int(arg['i22'])
        else:
            return
        data = {
            's1': self.ui.side_input_1.isChecked(),
            's2': self.ui.side_input_2.isChecked(),
            's3': self.ui.side_input_3.isChecked(),
            's4': self.ui.side_input_4.text(),
            's5': self.ui.side_input_5.text(),
            's6': self.ui.side_input_6.text(),
            's7': self.ui.side_input_7.text(),
            's8': self.ui.side_input_8.isChecked(),
            's9': self.ui.side_input_9.isChecked(),
            's10': self.ui.side_input_10.text(),
            's11': self.ui.side_input_11.text(),
            's12': self.ui.side_input_12.text(),
            's13': self.ui.side_input_13.text(),
        }
        if data['s2'] and not data['s3'] and not get_splitted_by_pipe(
                data['s4']) and not get_splitted_by_pipe(
                    data['s5']) and not get_splitted_by_pipe(
                        data['s6']) and not get_splitted_by_pipe(data['s7']):
            return self.show_message(
                "<b>Only Allow System</b> is enabled but nothing to do!")
        if data['s8'] and not data['s9'] and not get_splitted_by_pipe(
                data['s10']) and not get_splitted_by_pipe(
                    data['s11']) and not get_splitted_by_pipe(
                        data['s12']) and not get_splitted_by_pipe(data['s13']):
            return self.show_message(
                "<b>Ignore System</b> is enabled but nothing to do!")
        if len(self.FILEDATA.selected_folders) == 0:
            return self.show_message("No <b>Folder</b> is selected!")

        if self.rename_ui == None:
            self.rename_ui = RenameDialog()

        self.rename_ui.set_data(self.FILEDATA.get_all_folders(data['s1']),
                                code, data, arg)
        self.rename_ui.show()
Ejemplo n.º 23
0
class Calculator(QMainWindow):
    QFontDatabase.addApplicationFont(app.get_resource('font'))
    ui, version, main_ic = Ui_MainWindow(
    ), app.build_settings['version'], app.get_resource('icon.png')
    history = History()

    def __init__(self, parent=None):
        super(Calculator, self).__init__(parent)
        QApplication.setStyle(QStyleFactory.create('Fusion'))
        self.make_power_enabled = False
        self.ui.setupUi(self)
        setup(self, app.get_resource('backspace.png'))
        self.exp = Expression()
        self.on_ac_click()

    def show_history(self, do):
        self.update_expression()
        if not self.exp.is_error():
            exp = self.history.show(do, self.exp.exp)
            if exp:
                self.exp.set_exp(exp)
                self.update_monitor()
        else:
            self.history.out()

    def copy(self):
        self.update_expression()
        if not self.exp.is_error():
            exp = self.exp.exp[self.exp.start:self.exp.
                               end] if self.exp.has_selection(
                               ) else self.exp.exp
            for k, v in ADVANCED_KEYS.items():
                if k not in ['^', 'π', '√', '∛', 'Ŷ']:
                    exp = exp.replace(k, v)
            exp = exp.replace('Ŷ', 'rootx(')
            if exp:
                pyperclip.copy(exp)
                return True
        return False

    def cut(self):
        if self.copy():
            self.history.out()
            if self.exp.has_selection():
                self.on_back_click()
            else:
                self.exp.reset()
                self.update_monitor()

    def paste(self):
        paste = pyperclip.paste()
        self.update_expression()
        if paste and not self.exp.is_error():
            self.history.out()
            paste = paste.replace('sin⁻¹',
                                  'asin').replace('cos⁻¹', 'acos').replace(
                                      'tan⁻¹',
                                      'atan').replace('rootx(',
                                                      'Ŷ').replace(' ', '')
            for k, v in ADVANCED_KEYS.items():
                if k not in ['^', 'π', '√', '∛', 'Ŷ']:
                    paste = paste.replace(v, k)
            for i in paste:
                if not is_symbol(i):
                    self.last_invalid_exp = self.exp.exp
                    self.exp.set_exp(ERRORS[5])
                    self.update_monitor()
                    return
            self.exp.put_data_on_exp(paste)
            self.update_monitor()

    def on_power_click(self):
        if self.make_power_enabled:
            self.ui.bt_11.setStyleSheet("QToolButton {background: #80bfff}")
            self.make_power_enabled = False
        else:
            self.ui.bt_11.setStyleSheet(
                "QToolButton {background: orange; border:3px outset red;} QToolButton:pressed {background: orange; border:3px inset red;}"
            )
            self.make_power_enabled = True

    def if_clicked(self, bt, as_power=False):
        self.update_expression()
        if not self.exp.is_error():
            self.history.out()
            if self.make_power_enabled or as_power:
                bt = make_power(bt)
            bt = MONITOR_SYMBOLS.get(bt, bt)
            self.exp.put_data_on_exp('0' + bt if self.exp.exp == '0' and self.
                                     exp.pos == 1 and bt in AFTER_0 else bt)
            self.update_monitor()

    def on_plus_minus_click(self):
        self.update_expression()
        if not self.exp.is_error():
            self.history.out()
            if self.exp.exp.startswith('-'):
                self.exp.set_exp(self.exp.exp[1:], self.exp.pos - 1)
            elif self.exp.exp.startswith('+'):
                self.exp.set_exp('-' + self.exp.exp[1:], change_pos=False)
            else:
                self.exp.set_exp('-' + self.exp.exp, self.exp.pos + 1)
            self.update_monitor()

    def on_back_click(self, delete=False):
        self.update_expression()
        if not self.exp.is_error() and self.exp.exp != '0':
            self.history.out()
            change_pos, pos = True, None
            if self.exp.has_selection():
                res, pos = self.exp.exp[:self.exp.start] + self.exp.exp[
                    self.exp.end:], self.exp.start
            elif delete:
                res, change_pos = self.exp.exp[:self.exp.pos] + self.exp.exp[
                    self.exp.pos + 1:], False
            else:
                res, pos = self.exp.exp[:self.exp.pos - 1] + self.exp.exp[
                    self.exp.pos:], self.exp.pos - 1
            if res:
                self.exp.set_exp(res, pos, change_pos)
            else:
                self.exp.reset()
        self.update_monitor()

    def on_ac_click(self):
        self.memory = 0.0
        self.history.clear()
        self.on_c_click()

    def on_c_click(self):
        self.history.out()
        if self.make_power_enabled:
            self.on_power_click()
        self.last_invalid_exp = None
        self.exp.reset()
        self.update_monitor()

    def on_all_m_click(self, do=0):
        # 0 = get current memory or 1 = plus memory or 2 = minus memory or 3 = clear memory
        if do == 3:
            self.memory = 0.0
        elif not self.exp.is_error():
            self.update_expression()
            if do == 0:
                self.history.out()
                r = str(self.memory)
                if r.endswith('.0'):
                    r = r.replace('.0', '')
                self.exp.put_data_on_exp(r)
                self.update_monitor()
            elif do in (1, 2):
                res = get_result(self.exp.exp, self.ui.radio_bt_1.isChecked())
                if error(res):
                    self.history.out()
                    self.last_invalid_exp = self.exp.exp
                    self.exp.set_exp(res)
                    self.update_monitor()
                else:
                    try:
                        exp_float = float(res)
                        self.memory += exp_float if do == 1 else -exp_float
                    except:
                        self.history.out()
                        self.last_invalid_exp = self.exp.exp
                        self.exp.set_exp(ERRORS[2])
                        self.update_monitor()

    def on_ce_click(self):
        self.update_expression()
        if self.exp.is_error():
            self.history.out()
            self.exp.set_exp(self.last_invalid_exp)
            self.update_monitor()

    def on_equal_click(self):
        self.update_expression()
        if not self.exp.is_error():
            self.history.out()
            res = get_result(self.exp.exp, self.ui.radio_bt_1.isChecked())
            if self.make_power_enabled:
                self.on_power_click()
            if error(res):
                self.last_invalid_exp = self.exp.exp
            else:
                self.history.history.append(self.exp.exp)
            self.exp.set_exp(res)
            self.update_monitor()

    def update_expression(self):
        self.exp.update(str(self.ui.main_bar.toPlainText()),
                        self.ui.main_bar.textCursor())

    def update_monitor(self):
        self.ui.main_bar.setText(self.exp.exp)
        if self.exp.new_pos is None:
            self.ui.main_bar.moveCursor(QTextCursor.End)
        else:
            self.ui.main_bar.moveCursor(QTextCursor.Start)
            for _ in range(0, self.exp.new_pos):
                self.ui.main_bar.moveCursor(QTextCursor.Right)
Ejemplo n.º 24
0
        connection.execute(create_register_query)
        connection.execute(create_log_query)
        #connection.execute(create_field_query,FEILDS_LIST)
        connection.close()
        print('new document register created')
    except:
        print("failed... sqlite probably")


# prepoluate tree
def populate_tree():
    print('populating filee tree')


def populate_form():
    print('popoulating form')


def add_tracked_file():
    print('new file tracked')


if __name__ == "__main__":
    # run main code
    app = QtWidgets.QApplication(sys.argv)
    ex = Ui_MainWindow()
    w = CDMMainWindow()
    ex.setupUi(w)
    w.show()
    sys.exit(app.exec_())
Ejemplo n.º 25
0
 def __init__(self):
     super(MainWindow, self).__init__()
     self.ui = Ui_MainWindow()
     self.ui.setupUi(self)
from PyQt5.QtWidgets import QApplication, QMainWindow
from main_ui import Ui_MainWindow
import sys

if __name__ == '__main__':
    app = QApplication(sys.argv)
    mainWindow = QMainWindow()
    ui_MainWindow = Ui_MainWindow()
    ui_MainWindow.setupUi(mainWindow)
    mainWindow.show()
    sys.exit(app.exec_())
Ejemplo n.º 27
0
Archivo: main.py Proyecto: Alibhji/ROS
 def __init__(self):
     super(appWin, self).__init__()
     self.ui = Ui_MainWindow()
     self.ui.setupUi(self)
     self.config()
Ejemplo n.º 28
0
    def __init__(self):
        super(MainWindow, self).__init__()
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        # style window 
        self.setWindowTitle("Waifu File Sort")
        app_icon = QtGui.QIcon()
        app_icon.addFile("./icons/waifu_sort.png", QtCore.QSize(256, 256))
        self.setWindowIcon(app_icon)

        # store important data
        self.path_hotkey_dict = {}
        self.hotkey_path_dict = {}
        self._shortcut_list = []
        self.undo_list = []
        self.delete_folder = str(pathlib.Path(find_data_file("delete")))
        self.current_file_folder = ""
        self.pic_ext_list = [".jpg", ".png", ".webp", ".JPEG", ".PNG"]
        self.default_palette = QtGui.QGuiApplication.palette()

        # initialize source directory
        self.model = QFileSystemModel()
        self.model.setNameFilters(
            ["*.jpg", "*.png", "*.webp", "*.JPEG", "*.PNG"])
        self.model.setNameFilterDisables(False)
        self.ui.treeView.setModel(self.model)
        self.ui.treeView.setSelectionMode(QAbstractItemView.SingleSelection)
        self.ui.tableWidget.setSelectionMode(
            QtWidgets.QAbstractItemView.SingleSelection
        )
        self.ui.treeView.selectionModel().selectionChanged.connect(
            self.update_image_label
        )

        # hotkeys
        self.delShortcut = QShortcut(QKeySequence("Delete"), self)
        self.delShortcut.activated.connect(
            partial(self.move_cb, None, self.delete_folder)
        )

        self.undoShortcut = QShortcut(QKeySequence("Ctrl+Z"), self)
        self.undoShortcut.activated.connect(self.undo_cb)


        # callbacks init
        self.ui.browseBtn.clicked.connect(self.browse_source_click)
        self.ui.addDest.clicked.connect(self.add_dest_to_table)
        self.ui.removeDest.clicked.connect(self.remove_destination)
        self.ui.actionAbout.triggered.connect(self.show_about_dialog)
        self.ui.actionSave_Preset.triggered.connect(self.save_preset_cb)
        self.ui.actionLoad_Preset.triggered.connect(self.load_preset_cb)
        self.ui.actionClear_Delete_Folder.triggered.connect(self.clear_deleted_folder)
        self.ui.unmoveBtn.clicked.connect(self.undo_cb)
        self.ui.checkDeletedBtn.clicked.connect(self.check_deleted_btn_cb)
        self.ui.actionFancy.triggered.connect(self.set_fancy_style)
        self.ui.actionLight.triggered.connect(self.set_light_style)
        self.ui.actionDark.triggered.connect(self.set_dark_style)
        self.ui.comboMode.currentTextChanged.connect(self.change_file_type)
        self.ui.actionOrange.triggered.connect(self.set_orange_style)
        self.ui.actionRemove_Duplicates.triggered.connect(
            self.remove_duplicate_pictures)
        self.ui.actionRemove_Duplicates_Recursively.triggered.connect(
            partial(self.remove_duplicate_pictures, recursive_delete=True))

        self.set_dark_style()
Ejemplo n.º 29
0
 def __init__(self):
     super(AppWindow,self).__init__()
     self.ui= Ui_MainWindow()
     self.ui.setupUi(self)
     self.UI_config()
Ejemplo n.º 30
0
    def __init__(self):
        # Initialize GUI
        QMainWindow.__init__(self)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        # Initialize Backend
        self.core = AuthWall()

        # Move Window
        def moveWindow(event):
            if event.buttons() == Qt.LeftButton:
                self.move(self.pos() + event.globalPos() - self.dragPos)
                self.dragPos = event.globalPos()
                event.accept()

        # Custom Title Bar
        self.ui.frame_2.mouseMoveEvent = moveWindow

        # Exit Button
        self.ui.Exit.clicked.connect(lambda: sys.exit())

        # Remove Window Frame & Make background translucent
        self.setWindowFlag(QtCore.Qt.FramelessWindowHint)
        self.setAttribute(QtCore.Qt.WA_TranslucentBackground)

        # Add Security Questions
        self.ui.sqR.addItem("Your favorite actor?")
        self.ui.sqR.addItem("Your celebrity/high school crush?")
        self.ui.sqR.addItem("Your kink?")
        self.ui.sqR.setCurrentIndex(-1)
        self.ui.sqP.addItem("Your favorite actor?")
        self.ui.sqP.addItem("Your celebrity/high school crush?")
        self.ui.sqP.addItem("Your kink?")
        self.ui.sqP.setCurrentIndex(-1)

        # Navigation Button Configurations
        self.ui.LogInBtn.clicked.connect(
            lambda: self.ui.stackedWidget.setCurrentWidget(self.ui.Login))
        self.ui.RegisterBtn.clicked.connect(
            lambda: self.ui.stackedWidget.setCurrentWidget(self.ui.Register))
        self.ui.DeleteUserBtn.clicked.connect(
            lambda: self.ui.stackedWidget.setCurrentWidget(self.ui.Delete))
        self.ui.ResetPasswordBtn.clicked.connect(
            lambda: self.ui.stackedWidget.setCurrentWidget(self.ui.Reset))

        # Home Button Configuration
        self.ui.Back.clicked.connect(
            lambda: self.ui.stackedWidget.setCurrentWidget(self.ui.Home))
        self.ui.Back.clicked.connect(lambda: self._reset())

        # Reset
        self._reset()

        # LogIn Page Connect
        self.ui.UserL.textChanged.connect(self.checkLogin)
        self.ui.PassL.textChanged.connect(self.checkLogin)
        self.ui.SubmitL.clicked.connect(self.Login)

        # Register Page Connect
        self.ui.UserR.textChanged.connect(self.checkRegister)
        self.ui.PassR.textChanged.connect(self.checkRegister)
        self.ui.sqR.currentIndexChanged.connect(self.checkRegister)
        self.ui.SQR.textChanged.connect(self.checkRegister)
        self.ui.SubmitR.clicked.connect(self.Register)

        # LogIn Page Connect
        self.ui.UserD.textChanged.connect(self.checkDelete)
        self.ui.PassD.textChanged.connect(self.checkDelete)
        self.ui.SubmitD.clicked.connect(self.Delete)

        # Reset Page Connecte
        self.ui.UserP.textChanged.connect(self.checkReset)
        self.ui.PassP.textChanged.connect(self.checkReset)
        self.ui.SQP.textChanged.connect(self.checkReset)
        self.ui.sqP.currentIndexChanged.connect(self.checkReset)
        self.ui.SubmitP.clicked.connect(self.Reset)

        # Initialize Window
        self.show()