示例#1
0
    def SetDesgin(self):
        ''' All design Management Done in Here'''
        try:
            self.description_btn.setFixedSize(210, 30)
            self.author_and_license_btn.setFixedSize(210, 30)
            self.contact_btn.setFixedSize(210, 30)
        except:
            self.description_btn =GUILibraries.QPushButton('Description')
            self.author_and_license_btn =GUILibraries.QPushButton('Author and License')
            self.contact_btn =GUILibraries.QPushButton('Contact')
            self.close_btn =GUILibraries.QPushButton('Close')

        pic =GUILibraries.QLabel(self)
        pic.setGeometry(30, 30, 500, 600)
        pic.setFixedSize(400,400)

        '''use full ABSOLUTE path to the image, not relative'''

        pic.setPixmap(GUILibraries.QPixmap(self.Fixity.Configuration.getLogoSignSmall()))

        self.description_btn.clicked.connect(self.showDescription)
        self.author_and_license_btn.clicked.connect(self.showLicense)
        self.contact_btn.clicked.connect(self.showContact)
        self.close_btn.clicked.connect(self.Cancel)

        self.detail_layout.addWidget(self.description_btn)
        self.detail_layout.addWidget(self.author_and_license_btn)
        self.detail_layout.addWidget(self.contact_btn)
        self.detail_layout.addWidget(pic)
        self.pgroup.setLayout(self.detail_layout)

        slay =GUILibraries.QVBoxLayout()
        if OS_Info == 'Windows':
            self.heading.setFixedSize(485,40)
            self.content.setFixedSize(485,500)
        else:
            self.heading.setFixedSize(500,40)
            self.content.setFixedSize(500,500)

        slay.addWidget(self.heading)
        slay.addWidget(self.content)
        self.close_btn.setFixedSize(200,30)
        slay.addWidget(self.close_btn)
        if OS_Info == 'Windows':
            self.about_layout.setFixedSize(495, 600)
        else:
            self.about_layout.setFixedSize(540, 600)
        self.pgroup.setFixedSize(255, 600)
        self.main.addWidget(self.pgroup)
        self.main.addWidget(self.about_layout)

        self.about_layout.setLayout(slay)
        self.setLayout(self.main)
        self.showDescription()
示例#2
0
    def SetDesgin(self):

        self.GetLayout().addStrut(400)

        # Initializing view elements
        self.orignalPathLable = GUILibraries.QLabel()
        self.changePathToLable = GUILibraries.QLabel()
        self.setInformation = GUILibraries.QPushButton(
            "&Orignal Path Information")
        self.setInformation = GUILibraries.QPushButton("&Change Path")
        self.cancel = GUILibraries.QPushButton("Do Not Change Path")
        self.orignalPath = GUILibraries.QTextEdit()
        self.changePathTo = GUILibraries.QTextEdit()

        # Set view text
        self.orignalPath.setText(self.orignal_path_text)
        self.changePathTo.setText(self.change_path_text)
        self.orignalPathLable.setText('Change Path From')
        self.changePathToLable.setText('To')
        self.orignalPath.setDisabled(True)
        self.changePathTo.setDisabled(True)

        # Styling
        self.orignalPath.setMaximumSize(400, 100)
        self.changePathTo.setMaximumSize(400, 100)
        self.cancel.setMaximumSize(200, 100)
        self.setInformation.setMaximumSize(200, 100)

        # Set Widget to layouts
        self.GetLayout().addWidget(self.orignalPathLable)
        self.GetLayout().addWidget(self.orignalPath)
        self.GetLayout().addWidget(self.changePathToLable)
        self.GetLayout().addWidget(self.changePathTo)
        self.GetLayout().addWidget(self.setInformation)
        self.GetLayout().addWidget(self.cancel)

        # Set triggers
        self.setInformation.clicked.connect(self.changeRootDirInfo)
        self.cancel.clicked.connect(self.CloseClick)
        self.SetWindowLayout()
示例#3
0
    def Save(self):
        try:
            self.Fixity = SharedApp.SharedApp.App
        except:
            pass

        msgBox = GUILibraries.QLabel('Loading')

        selected_project = self.projects.currentText()
        algo_value_selected = self.methods.currentText()

        if selected_project is None or selected_project == '':
            self.notification.showError(
                self, "Warning", GUILibraries.messages['no_project_selected'])
            return

        project_core = self.Fixity.ProjectRepo.getSingleProject(
            str(selected_project))

        if project_core.getAlgorithm() == algo_value_selected:
            self.notification.showWarning(
                self, "Failure",
                GUILibraries.messages['already_using_algorithm'])
            return

        last_dif_paths_info = self.Fixity.Database.select(
            self.Fixity.Database._tableProject, '*', "`id` = '" + str(id) +
            "' OR `title` like '" + project_core.getTitle() + "'")
        try:
            project_core.setLast_dif_paths(
                str(last_dif_paths_info[0]['lastDifPaths']))
            project_core.setFilters(str(last_dif_paths_info[0]['filters']))
            project_core.setAlgorithm(
                str(last_dif_paths_info[0]['selectedAlgo']))
            #project_core.setProject_ran_before(str(last_dif_paths_info[0]['projectRanBefore']))
        except:
            pass

        msgBox.setWindowTitle("Processing ....")
        msgBox.setText("Reading Files, please wait ...")
        msgBox.show()

        GUILibraries.QCoreApplication.processEvents()

        project_core.SaveSchedule()
        result_of_all_file_confirmed = {}

        if not (project_core.getProject_ran_before() == 0
                or project_core.getProject_ran_before() == '0'
                or project_core.getProject_ran_before() == ''
                or project_core.getProject_ran_before() == 'None'
                or project_core.getProject_ran_before() is None):
            if project_core.getProject_ran_before(
            ) == 1 or project_core.getProject_ran_before() == '1':
                result_of_all_file_confirmed = project_core.Run(True)
            else:
                result_of_all_file_confirmed['file_changed_found'] = False

        else:
            result_of_all_file_confirmed['file_changed_found'] = False

        msgBox.close()

        if bool(result_of_all_file_confirmed['file_changed_found']):
            self.notification.showWarning(
                self, 'Failure',
                GUILibraries.messages['alog_not_changed_mail'])
            email_config = self.Fixity.Configuration.getEmailConfiguration()
            try:
                if email_config['smtp'] != '' and email_config[
                        'smtp'] is not None:
                    email_notification = EmailNotification.EmailNotification()
                    if project_core.getEmail_address(
                    ) != '' and project_core.getEmail_address() is not None:
                        try:
                            project_name = project_core.getTitle()
                        except:
                            project_name = ''
                        email_notification.ErrorEmail(
                            project_core.getEmail_address(),
                            result_of_all_file_confirmed['report_path'],
                            GUILibraries.messages['alog_not_changed_mail'],
                            email_config, project_name)
            except:
                self.Fixity.logger.LogException(Exception.message)
                pass
            return

        update_project_algo = {}
        update_project_algo['selectedAlgo'] = algo_value_selected
        self.Fixity.Database.update(self.Fixity.Database._tableProject,
                                    update_project_algo,
                                    "id='" + str(project_core.getID()) + "'")

        project_core.setAlgorithm(algo_value_selected)

        msgBox.setWindowTitle("Processing ....")
        msgBox.setText("Changing Algorithm, please wait ...")
        msgBox.show()

        GUILibraries.QCoreApplication.processEvents()
        project_core.SaveSchedule()

        if project_core.getProject_ran_before() == 1:
            project_core.Run(False, False, True)

        msgBox.close()
        SharedApp.SharedApp.App = self.Fixity
        self.notification.showInformation(
            self, "Success", selected_project + "'s " +
            GUILibraries.messages['algorithm_success'])
        self.Cancel()
示例#4
0
    def SetDesgin(self):
        self.GetLayout().addStrut(200)
        self.Fixity.Configuration.fetchEmailConfiguration()
        self.email_addr_bar = GUILibraries.QLineEdit()
        self.out_going_mail_server = GUILibraries.QLineEdit()
        self.port = GUILibraries.QLineEdit()
        self.password = GUILibraries.QLineEdit()
        self.SSL_protocol = GUILibraries.QRadioButton("SSL Protocols")
        self.TLS_protocol = GUILibraries.QRadioButton("TLS Protocols")
        self.none_protocol = GUILibraries.QRadioButton("None")

        self.password.setEchoMode(GUILibraries.QLineEdit.Password)
        self.set_information = GUILibraries.QPushButton("Save && Close")
        self.reset = GUILibraries.QPushButton("Reset")
        self.check_email = GUILibraries.QPushButton("Check Credentials")
        self.cancel = GUILibraries.QPushButton("Close Without Saving")
        self.loader = GUILibraries.QLabel("Sending Email...")

        self.email_addr_bar.setPlaceholderText("email: [email protected]")
        self.password.setPlaceholderText("Password")
        self.out_going_mail_server.setPlaceholderText("smtp.gmail.com")
        self.port.setPlaceholderText("Port")

        self.email_addr_bar.setMaximumSize(200, 100)
        self.password.setMaximumSize(200, 100)
        self.reset.setMaximumSize(200, 100)
        self.cancel.setMaximumSize(200, 100)
        self.set_information.setMaximumSize(200, 100)
        self.out_going_mail_server.setMaximumSize(200, 100)
        self.port.setMaximumSize(200, 100)
        self.check_email.setMaximumSize(200, 100)

        self.SMTP_server_lable = GUILibraries.QLabel('SMTP Server')
        self.email_address_lable = GUILibraries.QLabel('Email Address')
        self.password_lable = GUILibraries.QLabel('Password')
        self.port_lable = GUILibraries.QLabel('Port')
        self.encryption_lable = GUILibraries.QLabel('Encryption Method')

        self.GetLayout().addWidget(self.loader)
        self.GetLayout().addWidget(self.SMTP_server_lable)
        self.GetLayout().addWidget(self.out_going_mail_server)

        self.GetLayout().addWidget(self.email_address_lable)
        self.GetLayout().addWidget(self.email_addr_bar)

        self.GetLayout().addWidget(self.password_lable)
        self.GetLayout().addWidget(self.password)

        self.GetLayout().addWidget(self.port_lable)
        self.GetLayout().addWidget(self.port)

        self.GetLayout().addWidget(self.encryption_lable)
        self.GetLayout().addWidget(self.SSL_protocol)
        self.GetLayout().addWidget(self.TLS_protocol)
        self.GetLayout().addWidget(self.none_protocol)
        self.GetLayout().addWidget(self.set_information)
        self.GetLayout().addWidget(self.check_email)
        self.GetLayout().addWidget(self.reset)
        self.GetLayout().addWidget(self.cancel)

        self.loader.hide()

        self.reset.clicked.connect(self.ResetForm)
        self.set_information.clicked.connect(self.Save)
        self.cancel.clicked.connect(self.CloseClick)
        self.check_email.clicked.connect(self.checkIsEmailValid)
        self.SSL_protocol.clicked.connect(self.SSL_protocolConif)
        self.TLS_protocol.clicked.connect(self.TLS_protocolConif)
        self.none_protocol.clicked.connect(self.none_protocolConif)

        self.SetWindowLayout()
        information = self.Fixity.Configuration.getEmailConfiguration()
        self.out_going_mail_server.setText('smtp.gmail.com')
        self.setInformation(information)

        self.TLS_protocol.setChecked(True)
        self.TLS_protocol.click()
        try:
            if information is not None and len(
                    information) > 0 and information['smtp'] != None:
                self.setInformation(information)
        except:
            pass
示例#5
0
    def creatSchedulingOptions(self):
        self.scheduling_groupBox = GUILibraries.QGroupBox("Scheduling")
        self.monthly = GUILibraries.QRadioButton("Monthly")
        self.weekly = GUILibraries.QRadioButton("Weekly")
        self.daily = GUILibraries.QRadioButton("Daily")

        self.run_only_on_ac_power = GUILibraries.QCheckBox(
            "Run when on battery power")
        self.start_when_available = GUILibraries.QCheckBox(
            "If missed, run upon restart")
        self.email_only_when_something_changed = GUILibraries.QCheckBox(
            "Email only upon warning or failure")

        self.run_only_on_ac_power.clicked.connect(self.changed)
        self.start_when_available.clicked.connect(self.changed)
        self.email_only_when_something_changed.clicked.connect(self.changed)

        self.run_only_on_ac_power.setChecked(True)
        self.start_when_available.setChecked(True)
        self.email_only_when_something_changed.setChecked(True)

        self.monthly.clicked.connect(self.monthClick)
        self.weekly.clicked.connect(self.weekClick)
        self.daily.clicked.connect(self.dayClick)

        self.switchDebugger(True)
        self.scheduling_layout = GUILibraries.QVBoxLayout()

        self.scheduling_layout.addWidget(self.monthly)
        self.scheduling_layout.addWidget(self.weekly)
        self.scheduling_layout.addWidget(self.daily)
        self.scheduler_run_time = GUILibraries.QLabel("Scheduler Run Time: ")
        self.scheduling_layout.addWidget(self.scheduler_run_time)
        self.timer = GUILibraries.QTimeEdit(GUILibraries.QTime())

        self.timer.setDisplayFormat(self.Fixity.Configuration.getTimeFormat())
        self.scheduling_layout.addWidget(self.timer)

        self.scheduler_run_on = GUILibraries.QLabel("Scheduler Run On: ")
        self.scheduling_layout.addWidget(self.scheduler_run_on)
        self.day_of_week = GUILibraries.QComboBox()
        self.day_of_week.addItems(self.Fixity.Configuration.getWeekDays())
        self.day_of_week.activated.connect(self.changed)
        self.scheduling_layout.addWidget(self.day_of_week)
        self.day_of_week.hide()

        self.day_of_month = GUILibraries.QSpinBox()
        self.day_of_month.setMaximum(31)
        self.day_of_month.setMinimum(1)

        self.day_of_month.valueChanged.connect(self.changed)
        self.scheduling_layout.addWidget(self.day_of_month)
        self.day_of_month.hide()

        self.spacer = GUILibraries.QSpacerItem(125, 30)
        self.scheduling_layout.addItem(self.spacer)
        system_information = self.Fixity.Configuration.getWindowsInformation()

        if self.Fixity.Configuration.getOsType() == 'Windows' and (
                str(system_information['WindowsType']) == '7'
                or str(system_information['WindowsType']) == '10'
                or str(system_information['WindowsType']) == '8'):
            self.scheduling_layout.addWidget(self.run_only_on_ac_power)
            self.scheduling_layout.addWidget(self.start_when_available)
        self.scheduling_layout.addWidget(
            self.email_only_when_something_changed)

        self.lastrun = GUILibraries.QLabel("Last checked: ")
        self.scheduling_layout.addWidget(self.lastrun)
        self.scheduling_groupBox.setLayout(self.scheduling_layout)
        self.scheduling_groupBox.setFixedSize(260, 289)