Пример #1
0
 def mouseDoubleClickEvent(self, event):
     if self.kind == "directory":
         self.double_clicked.emit()
     else:
         print("execute =", os.path.join(self.path, self.name))
         file = "\"" + os.path.join(self.path, self.name) + "\""
         QProcess.execute("/usr/bin/open " + file)
Пример #2
0
class Thread_face(QThread):  # thread for face detection
    def __init__(self):
        super(Thread_face, self).__init__()

    def run(self):
        self.plaunch = QProcess()
        self.plaunch.execute("rosrun", ["ros_vision_demo", "control_test4.py"])
        self.plaunch.waitForFinished()
Пример #3
0
 def thunder_add_task(self, url):
     """
     @parame url
     """
     QProcess.execute(
         os.path.join(self._thunder_path,
                      ThunderDownloader.WIN_THUNDER_TASK_EXE), [url])
     print("start add task %s" % url)
Пример #4
0
    def execute_task(self):
        time.sleep(5)
        p = QProcess()
        temp = current_work_queue.pop()
        proc = temp[0]
        args = []
        args.append(temp[1])

        p.execute(proc, args)
Пример #5
0
class Thread_camera(QThread):  # thread for camera node
    def __init__(self):
        super(Thread_camera, self).__init__()

    def run(self):
        self.plaunch = QProcess()
        self.plaunch.execute("roslaunch",
                             ["ros_vision_demo", "rs_camera.launch"])
        self.plaunch.waitForFinished()
Пример #6
0
def scroll_yaw():
    global yaw
    yaw = float(ui.Scrollbar_yaw.value()) / 100
    pset = QProcess()
    attributes_postfix = ", frame_id: 'body', auto_arm: true}"
    attributes = "{pitch: " + repr(pitch) + ", roll: " + repr(
        roll) + ", yaw: " + repr(yaw) + ", thrust: " + repr(
            thrust) + attributes_postfix
    pset.execute("rosservice", ["call", "/set_attitude", attributes])
Пример #7
0
class Thread_controll(QThread):  # thread for controll node
    def __init__(self):
        super(Thread_controll, self).__init__()

    def run(self):
        self.pcontroll = QProcess()
        self.pcontroll.execute("roslaunch", ["clever", "clever.launch"])
        # self.pid = self.pcontroll.execute("roscore")
        self.pcontroll.waitForFinished()
Пример #8
0
def click_set():
    global pitch, roll, yaw, thrust
    pset = QProcess()
    global attributes_postfix
    attributes = "{pitch: " + repr(pitch) + ", roll: " + repr(
        roll) + ", yaw: " + repr(yaw) + ", thrust: " + repr(
            thrust) + attributes_postfix
    pset.execute("rosservice", ["call", "/set_attitude", attributes])
    print(attributes)
Пример #9
0
def click_unlock():
    # ui.video_play = True
    # print("video_play: " + repr(ui.video_play))
    ui.pushButton_unlock.setEnabled(True)  # False)
    ui.pushButton_lock.setEnabled(True)
    punlock = QProcess()
    punlock.execute("rosservice",
                    ["call", "/mavros/cmd/arming", "value: true"])
    punlock.waitForFinished()
Пример #10
0
class Thread_stopface(QThread):  # thread for stop face tracing
    def __init__(self):
        super(Thread_stopface, self).__init__()

    def run(self):
        self.pstopface = QProcess()
        self.pstopface.execute(
            "rosnode", ["kill", "$(rosnode", "list)", "|", "grep", "face"])
        self.pstopface.waitForFinished()
Пример #11
0
class Thread_client(QThread):  # thread for face detection
    def __init__(self):
        super(Thread_client, self).__init__()

    def run(self):
        self.pclient = QProcess()
        self.pclient.execute("python", [
            "/home/nvidia/catkin_ws/src/ros_vision_demo/scripts/sub_client.py"
        ])
        self.pclient.waitForFinished()
Пример #12
0
class Thread_stopcontroll(QThread):  # thread for shutdown controll nodes
    def __init__(self):
        super(Thread_stopcontroll, self).__init__()

    def run(self):
        self.pstopcontroll = QProcess()
        self.pstopcontroll.execute("killall", ["-9", "roslaunch"])
        # "rosnode", ["kill", "$(rosnode", "list)", "|", "grep", "face"])
        self.pstopcontroll.waitForFinished()
        self.pstopcontroll.execute("rosnode", ["kill", "-a"])
        self.pstopcontroll.waitForFinished()
Пример #13
0
def shutdown():
    server_pid = s.value("EquirectangularViewer/server_pid")
    if server_pid is not None:
        pid = int(server_pid)
        try:
            if WINDOWS:
                QProcess.execute('TASKKILL /PID %s' % pid)
            else:
                os.kill(pid, 11)
        except Exception:
            None
    return
Пример #14
0
 def mousePressEvent(self, event):
     if event.buttons() == Qt.LeftButton:
         if self.parent.file_field.name:
             file = "\"" + self.parent.file_field.path
             file += "/" + self.parent.file_field.name + "\""
             print(file)
             QProcess.execute("/usr/bin/open " + file)
         else:
             path = self.parent.current_path
             print(path)
             QProcess.startDetached(
                 "/Users/freeaks/source/filer/data/filer.py -p " + path)
         sys.exit(0)
Пример #15
0
 def stop_recording(self):
     if self.is_recording:
         self.process.close()
         print("stoppe Aufnahme")
         self.is_recording = False
         QProcess.execute("killall wget")
         self.saveRecord()
         self.stoprec_btn.setVisible(False)
         self.rec_btn.setVisible(True)
         self.recordAction.setText(
             f"starte Aufnahme von {self.urlCombo.currentText()}")
         self.recordAction.setIcon(QIcon.fromTheme("media-record"))
     else:
         self.showTrayMessage("Hinweis", "keine Aufnahme gestartet",
                              self.tIcon)
Пример #16
0
def showInFolder(path, open_file_as_fallback=False):
    '''
    Show a file or folder in explorer/finder, highlighting it where possible.
    Source: https://stackoverflow.com/a/46019091/3388962
    '''
    path = os.path.abspath(path)
    dirPath = path if os.path.isdir(path) else os.path.dirname(path)
    if sys.platform == 'win32':
        args = []
        args.append('/select,')
        args.append(QDir.toNativeSeparators(path))
        if QProcess.startDetached('explorer', args):
            return True
    elif sys.platform == 'darwin':
        args = []
        args.append('-e')
        args.append('tell application "Finder"')
        args.append('-e')
        args.append('activate')
        args.append('-e')
        args.append('select POSIX file "%s"' % path)
        args.append('-e')
        args.append('end tell')
        args.append('-e')
        args.append('return')
        if not QProcess.execute('/usr/bin/osascript', args):
            return True
        #if not QtCore.QProcess.execute('/usr/bin/open', [dirPath]):
        #    return
    # TODO: Linux is not implemented. It has many file managers (nautilus, xdg-open, etc.)
    # each of which needs special ways to highlight a file in a file manager window.

    # Fallback.
    return QDesktopServices.openUrl(
        QUrl(path if open_file_as_fallback else dirPath))
Пример #17
0
def show_in_file_explorer(path: str) -> bool:
    # https://stackoverflow.com/a/46019091/11881963
    if sys.platform == 'win32':
        args = []
        if not os.path.isdir(path):
            args.append('/select,')
        args.append(QDir.toNativeSeparators(path))
        QProcess.startDetached('explorer', args)
    elif sys.platform == 'darwin':
        args = [
            '-e', 'tell application "Finder"',
            '-e', 'activate',
            '-e', 'select POSIX file "%s"' % path,
            '-e', 'end tell',
            '-e', 'return',
        ]
        QProcess.execute('/usr/bin/osascript', args)
Пример #18
0
    def stopProcess(self):
        """Called by pressing stop button. Kills sen2cor running process."""
        # Asking for confirmation
        result = QMessageBox().question(
            self.dlg, self.tr("Stop process ?"),
            self.tr("Are you sure that you want to stop SEN2COR process ?"),
            QMessageBox.Yes, QMessageBox.No)
        if result == QMessageBox.Yes:
            if platform.system() == "Windows":
                # If we are on Windows, there is a way to kill all subprocesses in one command (using /T param)
                QProcess.execute("cmd", [
                    "/c", "taskkill", "/PID",
                    str(self.process.processId()), "/T", "/F"
                ])
            else:
                # If we are on Linux, we have to retrieve all subprocesses PIDs, so as to kill them.
                # Because SEN2COR creates its own child processes, we don't know their PIDs without retrieving them using ps command.
                childIds = []
                getChild = QProcess()
                parentPid = str(self.process.processId())
                getChild.start(
                    "ps", ["--ppid", parentPid, "-o", "pid", "--no-heading"])
                getChild.waitForFinished(5000)
                lastChildFound = str(getChild.readAllStandardOutput(),
                                     encoding='utf-8')
                lastChildFound = lastChildFound.replace('\n', '')
                lastChildFound = lastChildFound.replace(' ', '')

                if len(lastChildFound) >= 1:
                    # Iterate until the last child process found hasn't any subprocess
                    while len(lastChildFound) >= 1:
                        childIds.append(lastChildFound)
                        getChild.start("ps", [
                            "--ppid", lastChildFound, "-o", "pid",
                            "--no-heading"
                        ])
                        getChild.waitForFinished(5000)
                        lastChildFound = str(getChild.readAllStandardOutput(),
                                             encoding='utf-8')
                        lastChildFound = lastChildFound.replace('\n', '')
                        lastChildFound = lastChildFound.replace(' ', '')
                    QProcess.execute("kill", childIds)
                else:
                    self.process.terminate()
Пример #19
0
 def test_process(self):
     proc = QProcess()
     proc.start('python3', ["/home/kali/Desktop/Sublist3r/sublist3r.py", '-d', 'v.zzu.edu.cn'])
     proc.execute('python3 /home/kali/Desktop/Sublist3r/sublist3r.py -d v.zzu.edu.cn')
     proc.start('python3', ['/home/kali/Desktop/Sublist3r/sublist3r.py', '-d', 'www.v.zzu.edu.cn'])
     proc.execute('whatweb baidu.com')
     proc.start('touch test.txt')
     proc.execute('nmap' ,['baidu.com'])
     proc.waitForFinished()
     result = str(proc.readAllStandardOutput())
     proc.execute('dnsenum ')
Пример #20
0
    def apply_wallpaper(self):
        """
        Slot documentation goes here.
        """
        print('Applying wallpaper...')
        self.update_status_text('Applying wallpaper...')
        temp_path = os.path.join(tempfile.gettempdir(), 'bing_wallpaper.jpg')
        self.preview_image.save(temp_path, quality=100)
        self.changer.apply_wallpaper(temp_path)

        if self.cb_run_command.isChecked() and self.le_command.text():
            self.update_status_text('Running custom command...')
            error = QProcess.execute(self.le_command.text())
            if error:
                self.system_tray_icon.showMessage(
                    'Error running command',
                    'The command specified in the settings failed to run. Please check '
                    'the path.', QSystemTrayIcon.Critical)

        # Check for --quit command switch to see if we need to quit now that the wallpaper has been applied.
        if self.app.args.quit:
            print('Closing application...')
            self.app.quit()
Пример #21
0
 def checkForUpdateTriggered(self):
     QProcess.execute('updater.exe', ['/checknow'])
Пример #22
0
class WallpaperChanger(object):
    def __init__(self):
        self.settings = Settings()
        self.process = QProcess()

    def apply_wallpaper(self, filepath):
        system_platform = platform.system()
        if system_platform == 'Windows':
            return self._windows(filepath)
        elif system_platform == 'Linux':
            # Read desktop environment from settings.
            env = self.settings.linux_desktop
            print('Setting wallpaper using environment "{0:s}"'.format(env))
            if env == 'feh':
                return self._feh(filepath)
            elif env == 'unity':
                return self._unity(filepath)
            elif env == 'xfce4':
                return self._xfce4(filepath)
            elif env == 'mate':
                return self._mate(filepath)
            elif env == 'kde4':
                return self._kde4(filepath)
            elif env == 'cinnamon':
                return self._cinnamon(filepath)

    def _windows(self, filepath):
        import ctypes

        SPI_SETDESKWALLPAPER = 0x14  # According to http://support.microsoft.com/default.aspx?scid=97142
        SPIF_UPDATEINIFILE = 0x2
        ctypes.windll.user32.SystemParametersInfoW(SPI_SETDESKWALLPAPER, 0, filepath, SPIF_UPDATEINIFILE)

    def _feh(self, filepath):
        error = self.process.execute('feh --bg-scale {0:s}'.format(filepath))
        return not bool(error)

    def _unity(self, filepath):
        error = self.process.execute('gsettings set org.gnome.desktop.background picture-uri {0:s}'.format(filepath))
        return not bool(error)

    def _mate(self, filepath):
        error = self.process.execute('gsettings set org.mate.background picture-filename {0:s}'.format(filepath))
        return not bool(error)

    def _xfce4(self, filepath):
        self.process.start('xfconf-query -c xfce4-desktop -l')
        self.process.waitForFinished()
        properties = re.findall(r'(/backdrop/screen.*(?:last-image|image-path))',
                                str(self.process.readAllStandardOutput()))
        error = False
        for item in properties:
            self.process.start('xfconf-query --channel xfce4-desktop --property {0:s} --set {1:s}'.format(item, '/'))
            self.process.waitForFinished()
            self.process.start(
                'xfconf-query --channel xfce4-desktop --property {0:s} --set {1:s}'.format(item, filepath))
            self.process.waitForFinished()
            if self.process.exitCode():
                error = True
        return not error

    def _kde4(self, filepath):
        kde4_js = '''
var wallpaper = "{0:s}";
var activity = activities()[0];
activity.currentConfigGroup = ["Wallpaper","image"];
activity.writeConfig("wallpaper", wallpaper);
activity.writeConfig("userswallpaper", wallpaper);
activity.reloadConfig();
        '''.format(filepath)
        kde4_js_path = '/tmp/bwc_kde4_js'
        with open(kde4_js_path, 'w') as kde4_js_file:
            kde4_js_file.write(kde4_js)

        self.process.start('qdbus', ['org.kde.plasma-desktop', '/MainApplication', 'loadScriptInInteractiveConsole',
                                     kde4_js_path])
        self.process.waitForFinished()
        os.remove(kde4_js_path)

        self.process.start('dbus-send',
                           ['--dest=org.kde.plasma-desktop', '/MainApplication',
                            'org.kde.plasma-desktop.reparseConfiguration'])
        self.process.waitForFinished()
        self.process.start('dbus-send',
                           ['--dest=org.freedesktop.DBus', '/org/freedesktop/DBus',
                            'org.freedesktop.DBus.ReloadConfig'])
        self.process.waitForFinished()
        self.process.start('dbus-send',
                           ['--dest=org.kde.kwin', '/KWin', 'org.kde.KWin.reloadConfig'])
        self.process.waitForFinished()

        self.process.start('kbuildsycoca4')
        self.process.waitForFinished()
        self.process.start('kquitapp', ['plasma-desktop'])
        self.process.waitForFinished()
        self.process.start('kstart', ['plasma-desktop'])

    def _cinnamon(self, filepath):
        error = self.process.execute('gsettings set org.cinnamon.desktop.background picture-uri "file://{0:s}"'.format(filepath))
        return not bool(error)
Пример #23
0
 def checkForUpdateTriggered(self):
     QProcess.execute('updater.exe', ['/checknow'])
Пример #24
0
class MainWindow(QMainWindow):
    def __init__(self):
        super(MainWindow, self).__init__()
        self.setObjectName("myGitClone")
        root = QFileInfo.path(QFileInfo(QCoreApplication.arguments()[0]))
        print("root", root)
        self.icon = QIcon(f"{root}/favicon.ico")
        self.setWindowIcon(self.icon)
        self.setGeometry(0, 0, 800, 600)
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.setMinimumSize(400, 300)
        self.setDocumentMode(True)
        self.settings = QSettings('Axel Schneider', self.objectName())
        self.createStatusbar()
        self.createActions()
        self.createWidgets()
        QMetaObject.connectSlotsByName(self)
        self.readSettings()
        self.statusbar.showMessage("Ready")
        self.setWindowTitle("myGitClone")

        ### process
        ### shell settings
        self.process = QProcess(self)
        self.process.setProcessChannelMode(QProcess.MergedChannels)
        self.process.readyReadStandardError.connect(lambda: self.msg("Error"))
        self.process.started.connect(lambda: self.msg("starting shell"))
        self.process.finished.connect(lambda: self.msg("shell ended"))

    ### widgets ###
    def createWidgets(self):
        self.username = ""
        self.url = "https://github.com/%s?tab=repositories" % self.username
        self.repoList = []
        self.gitList = []
        self.dlFolder = QDir.homePath() + "/Downloads"

        ### table ###
        self.lb = QTableWidget()
        self.lb.setColumnCount(2)
        self.lb.setColumnWidth(0, 60)
        self.lb.horizontalHeader().setStretchLastSection(True)
        self.lb.setHorizontalHeaderItem(0, QTableWidgetItem("Select"))
        self.lb.setHorizontalHeaderItem(1, QTableWidgetItem("Repository Name"))

        ### username field ###
        self.uname = QLineEdit("")
        self.uname.setFixedWidth(180)
        self.uname.setPlaceholderText("insert user name")
        self.uname.returnPressed.connect(self.listRepos)

        ### get repos button ###
        self.uBtn = QPushButton(QIcon(self.icon), "get Repos List")
        self.uBtn.setToolTip("get all repos from user")
        self.uBtn.clicked.connect(self.listRepos)

        ### get repos button ###
        self.dlBtn = QPushButton(QIcon.fromTheme("download"),
                                 "download selected Repos")
        self.dlBtn.setToolTip("download selected repos from user")
        self.dlBtn.setFixedWidth(180)
        self.dlBtn.clicked.connect(self.create_dl_list)

        ### Layout
        self.ubox = QHBoxLayout()
        self.ubox.addWidget(self.uname)
        self.ubox.addWidget(self.uBtn)
        self.ubox.addStretch(1)
        self.ubox.addWidget(self.dlBtn)

        self.layout = QVBoxLayout()
        self.wid = QWidget()

        self.layout.addLayout(self.ubox)
        self.layout.addWidget(self.lb)
        self.wid.setLayout(self.layout)

        self.setCentralWidget(self.wid)

    ### actions ###
    def createActions(self):
        self.tbar = QToolBar()
        self.tbar.setIconSize(QSize(16, 16))
        self.tbar.setMovable(False)
        self.tbar.setToolButtonStyle(0)
        self.tbar.setContextMenuPolicy(Qt.PreventContextMenu)
        self.tbar.setObjectName("tbar")
        self.addToolBar(self.tbar)

        self.actionSettings = QAction(self,
                                      triggered=self.appSettings,
                                      toolTip="set output directory")
        icon = QIcon.fromTheme("preferences-system")
        self.actionSettings.setIcon(icon)
        self.actionSettings.setObjectName("actionSettings")

        self.actionAbout = QAction(self, triggered=self.aboutApp)
        icon = QIcon.fromTheme("help-about")
        self.actionAbout.setIcon(icon)

        self.tbar.addAction(self.actionSettings)
        self.tbar.addAction(self.actionAbout)

        ### statusbar###
    def createStatusbar(self):
        self.statusbar = QStatusBar(self)
        font = QFont()
        font.setPointSize(7)
        self.statusbar.setFont(font)
        self.statusbar.setObjectName("statusbar")
        self.setStatusBar(self.statusbar)

    ### get username from textfield
    def changeUsername(self):
        self.username = self.uname.text()
        self.url = "https://github.com/%s?tab=repositories" % self.username

    ### get user repos ##
    def listRepos(self):
        self.changeUsername()
        if self.username == "":
            self.msgBox("please type a username")
        else:
            self.lb.setRowCount(0)
            self.repoList = []
            repositories = self.get_repositories()
            print("%s %s" % ("get repos from", self.username))
            self.repoList = list(repositories)
            self.fillTable()
            self.msg("repos loaded")

    ### fill table with user repos
    def fillTable(self):
        self.lb.setRowCount(len(self.repoList))
        if self.lb.rowCount() > 0:
            for x in range(len(self.repoList)):
                rep = QTableWidgetItem(self.repoList[x])
                checkbox = QCheckBox(self.lb)
                checkbox.setStyleSheet("margin-left:20%; margin-right:10%;")
                checkbox.setCheckState(0)
                self.lb.setCellWidget(x, 0, checkbox)
                self.lb.setItem(x, 1, rep)

    ### table context menu
    def contextMenuEvent(self, event):
        self.menu = QMenu(self)
        if self.lb.selectionModel().hasSelection():
            # copy
            downloadAction = QAction(QIcon.fromTheme("download"),
                                     'download Repo', self)
            downloadAction.triggered.connect(
                lambda: self.downloadRepoFromList())
            ###
            self.menu.addAction(downloadAction)
            self.menu.popup(QCursor.pos())

    def listChanged(self):
        self.create_dl_list()

    ### get download list from selected repos
    def create_dl_list(self):
        r = ""
        self.gitList = []
        for x in range(self.lb.rowCount()):
            if self.lb.cellWidget(x, 0).checkState() == 2:
                r = self.lb.item(x, 1).text()
                self.gitList.append(r)
                print("%s %s" % (r, "is selected"))
                self.downloadRepo(r)

    ### download repo
    def downloadRepo(self, gitrepo):
        merror = ""
        cmd = "git clone --progress --verbose https://github.com/" + str(
            self.username) + "/" + str(gitrepo) + " " + str(
                self.dlFolder) + "/" + str(gitrepo)
        print("%s %s" % ("username is:", self.username))
        print(cmd)
        try:
            self.process.execute(cmd)
        except Exception as e:
            s = str(e)
            self.errorBox(s)

    ### download selected repo (context menu)
    def downloadRepoFromList(self):
        row = self.lb.selectionModel().selectedIndexes()[0].row()
        gitrepo = self.lb.item(row, 1).text()
        cmd = "git clone --progress --verbose https://github.com/" + str(
            self.username) + "/" + str(gitrepo) + " " + str(
                self.dlFolder) + "/" + str(gitrepo)
        print(cmd)
        self.process.execute(cmd)

    ### preferences
    def appSettings(self):
        if self.dlFolder == "":
            self.dlFolder = QDir.homePath()
        self.msg("settings called")
        path = QFileDialog.getExistingDirectory(self, "select Folder",
                                                self.dlFolder)
        if path:
            self.dlFolder = path
            print("%s %s" % ("download folder changed to", self.dlFolder))

    def closeEvent(self, e):
        self.writeSettings()
        e.accept()

    ### read settings from config file
    def readSettings(self):
        print("reading settings")
        if self.settings.contains('geometry'):
            self.setGeometry(self.settings.value('geometry'))
        if self.settings.contains('downloadFolder'):
            self.dlFolder = self.settings.value('downloadFolder')
            self.msg(self.dlFolder)
            print("%s %s" % ("download folder:", self.dlFolder))

    ### write settings to config file
    def writeSettings(self):
        print("writing settings")
        self.settings.setValue('geometry', self.geometry())
        self.settings.setValue('downloadFolder', self.dlFolder)

    ### about window
    def aboutApp(self):
        title = "about myGitClone"
        message = """
                    <span style='color: #3465a4; font-size: 18pt;font-weight: bold;'
                    >myGitClone</strong></span></p>
                    <h3>based on <a title='git_clones' href='https://github.com/rootVIII/git_clones' target='_blank'> git_clones</a> by James</h3>
                    <h4>created by  <a title='Axel Schneider' href='http://goodoldsongs.jimdo.com' target='_blank'>Axel Schneider</a> with PyQt5</h3>
                    <br>
                    <span style='color: #555753; font-size: 9pt;'>©2019 Axel Schneider, James</strong></span></p>
                        """
        self.infobox(title, message)

    ### error messagebox
    def errorBox(self, message):
        mwin = QMessageBox.warning(self, "Error", message)

    ### messagebox
    def infobox(self, title, message):
        QMessageBox.about(self, title, message).show()

    ### set statusbar text
    def msg(self, message):
        self.statusbar.showMessage(message)

    def msgBox(self, message):
        msg = QMessageBox.warning(self, "Information", message)

    ### begin from git_clones ###
    def http_get(self):
        if version_info[0] != 2:
            req = urlopen(self.url)
            return req.read().decode('utf-8')
        req = Request(self.url)
        request = urlopen(req)
        return request.read()

    def get_repo_data(self):
        try:
            response = self.http_get()
        except Exception as e:
            s = str(e)
            self.errorBox(s)
            print("Unable to make request to %s's Github page" % self.username)
            exit(1)
        else:
            pattern = r"<a\s?href\W+%s/(.*)\"\s+" % self.username
            for line in findall(pattern, response):
                yield line.split('\"')[0]

    def get_repositories(self):
        return set([repo for repo in self.get_repo_data()])
Пример #25
0
 def CodeShowClick(self):
     code = QProcess.execute("explorer code.txt")
Пример #26
0
 def IllustrateClick(self):
     illustrate = QProcess.execute("explorer illustrate.txt")
Пример #27
0
 def mouseDoubleClickEvent(self, event):
     if self.drawer:
         self.double_clicked.emit()
     else:
         file = "\"" + os.path.join(self.path, self.name) + "\""
         QProcess.execute("/usr/bin/open " + file)
Пример #28
0
       P_Age_I_Level[Age][4]*\
       P_Sex_I_Level[Sex][4]*\
       P_Marry_I_Level[Marry][4]*\
       P_House_I_Level[House][4]*\
       P_Edu_I_Level[Edu][4]*\
       P_Last_I_Level[Last][4]*\
       P_Work_I_Level[Work][4]*\
       P_Level[4]

    #求出最大概率,确定等级
    P_Level_Max = P_Level_1
    if P_Level_2 > P_Level_Max:
        P_Level_Max = P_Level_2
        Level = 2
    if P_Level_3 > P_Level_Max:
        P_Level_Max = P_Level_3
        Level = 3
    if P_Level_4 > P_Level_Max:
        P_Level_Max = P_Level_4
        Level = 4
    Level_Set[i] = Level

#将最大可能的信用等级写回待分析文件
Wxlsx = copy(AFile)
Wsheet = Wxlsx.get_sheet(0)
for i in range(1, NUMBER):
    Wsheet.write(i, 10, Level_Set[i])
Wxlsx.save(AFILE_AD)
#3-预测分析数据-结束
code = QProcess.execute("explorer D9待分析数据.xls")
Пример #29
0
 def run(self):
     mytask = QProcess()
     mytask.execute(self.proc, self.args)
Пример #30
0
 def mouseDoubleClickEvent(self, event):
     if self.drawer:
         self.double_clicked.emit()
     else:
         file = "\"" + os.path.join(self.path, self.name) + "\""
         QProcess.execute("/usr/bin/open " + file)