Ejemplo n.º 1
0
    def __init__(self, searchToolsWidget, invocationWidget):
        super().__init__()
        self.searchToolsWidget = searchToolsWidget
        self.invocationWidget = invocationWidget
        self.layout = QtWidgets.QVBoxLayout()

        self.executeButton = QtWidgets.QPushButton("Execute tool")
        self.cancelButton = QtWidgets.QPushButton("Cancel execution")
        self.cancelButton.hide()

        self.output = QtWidgets.QTextEdit()
        self.output.setReadOnly(True)

        self.layout.addWidget(self.executeButton)
        self.layout.addWidget(self.cancelButton)
        self.layout.addWidget(self.output)

        self.executeButton.clicked.connect(self.executeTool)
        self.cancelButton.clicked.connect(self.cancelExecution)

        self.process = QtCore.QProcess(self)
        self.process.readyRead.connect(self.dataReady)

        self.process.started.connect(self.processStarted)
        self.process.finished.connect(self.processFinished)

        self.setLayout(self.layout)
Ejemplo n.º 2
0
	def unmountDrive(self, eject=False):
		self.sig_beginOperation.emit("Unmounting...")
		self.txt_log.insertPlainText(f"Unmounting {self.device} from {self.txt_mountpoint.text()}...\n")

		self.proc_dismount = QtCore.QProcess()
		self.proc_dismount.finished.connect(lambda: self.unmountSuccess(eject))
		self.proc_dismount.start("umount", [self.txt_mountpoint.text()])
Ejemplo n.º 3
0
    def __init__(self):
        super(MenuManager, self).__init__()

        self.contentsDoc = None
        self.assistantProcess = QtCore.QProcess()
        self.helpRootUrl = ''
        self.docDir = QtCore.QDir()
        self.imgDir = QtCore.QDir()

        self.info = {}
        self.window = None

        self.ticker = None
        self.tickerInAnim = None
        self.upButton = None
        self.downButton = None
        self.helpEngine = None
        self.score = Score()
        self.currentMenu = "[no menu visible]"
        self.currentCategory = "[no category visible]"
        self.currentMenuButtons = "[no menu buttons visible]"
        self.currentInfo = "[no info visible]"
        self.currentMenuCode = -1
        self.readXmlDocument()
        self.initHelpEngine()
Ejemplo n.º 4
0
    def startRime(self):
        rime = self.manager.getInstance().rimeAccess
        manArgs = self.manager.getInstance().run_params

        self.process = QtCore.QProcess(self)
        self.process.setProcessChannelMode(QtCore.QProcess.MergedChannels)
        self.process.readyReadStandardOutput.connect(self.updateProgressBox)
        args = " ".join([manArgs['metadata_path'],  manArgs['rip_path'],  manArgs['output_path']]) + " "

        if not manArgs['output_stopwarnings']:
          args += "--ignore_warnings "
        if manArgs['output_netcdf4']:
          args += "--netcdf4 "
        if manArgs['output_hdf5']:
          args += "--hdf5 "
        if manArgs['output_geotiff']:
          args += "--geotiff "
        if manArgs['output_option_filehash']:
          args += "--checksum "
        
        self.timer = QtCore.QTimer(self)
        self.timer.setInterval(100)
        self.timer.timeout.connect(self.updateProgressBox)
        self.timer.start()
        self.process.start('python3 rime_main.py ' + args)
                
        '''
Ejemplo n.º 5
0
	def mountDrive(self):
		"""Mount the drive to the mount point"""

		self.sig_beginOperation.emit("Mounting tape...")
		self.txt_log.setText(f"Mounting {self.device} to {self.txt_mountpoint.text()}...\n")

		self.proc_mount = QtCore.QProcess()	
		self.proc_mount.finished.connect(self.mountSuccess)
		self.proc_mount.start("ltfs", [self.txt_mountpoint.text()])
Ejemplo n.º 6
0
    def run_qprocess(self):

        deint_setting = self.deint_combobox.currentText()
        subsampling_setting = self.subsampling_combobox.currentText()
        scale_setting = self.scale_combobox.currentText()
        vmaf_model_setting = self.vmaf_model_combobox.currentText()
        loglevel = self.loglevel_combobox.currentText()

        self.progressbar_step = 1
        self.progressbar.setValue(self.progressbar_step)

        inputpath_list_str = "{}".format(" ".join(self.inputPath_list))
        sync = self.le_sync.text()
        sw = self.le_sw.text()

        if sync == "":
            sync = "0"

        sync = sync.replace(',', '.')

        if sw == "":
            sw = "0"

        sw = sw.replace(',', '.')
        #sw = round(float(sw))
        sw = float(sw)

        if not self.ref_path or self.ref_path == None:
            #cmd = ("{0} -i {1}".format(self.videoAnalyzerPath, inputpath_list_str, sync, sw))
            cmd = ("{0} -i {1} -loglevel {2}".format(self.videoAnalyzerPath,
                                                     inputpath_list_str,
                                                     loglevel))
            cmd_list = cmd.split(" ")
        else:
            cmd = (
                "{0} -ref {1} -i {2} -sync {3} -sw {4} -deint {5} -subsampling {6} -scale {7} -vmaf_model {8} -loglevel {9}"
                .format(self.videoAnalyzerPath, self.ref_path,
                        inputpath_list_str, sync, sw, deint_setting,
                        subsampling_setting, scale_setting, vmaf_model_setting,
                        loglevel))
            cmd_list = cmd.split(" ")

        self.te_operation.append("*****************************")
        self.te_operation.append("STARTING VIDEO BENCH")
        self.te_operation.append(self.python_path + " " + cmd)
        self.te_operation.append("*****************************")

        process = QtCore.QProcess()
        process.setProcessChannelMode(QtCore.QProcess.MergedChannels)
        process.readyReadStandardOutput.connect(
            partial(self.dataReady, process))
        process.finished.connect(self.update_ui)
        process.setProgram(self.videoAnalyzerPath)
        process.start(self.python_path, cmd_list)

        self.setDisabled(True)
Ejemplo n.º 7
0
 def handle_action_folder_locate_triggered(self):
     curr_sel_ids = self.get_current_selection_ids()
     if 'sd_id' in curr_sel_ids:
         dr_sd = self._meta_files_mgr.get_scan_dir(curr_sel_ids['sd_id'])
         explorer_process = QtCore.QProcess()
         explorer_process.setProgram('explorer.exe')
         explorer_process.setArguments([
             '/select,%s' % QtCore.QDir.toNativeSeparators(dr_sd['abspath'])
         ])
         explorer_process.startDetached()
Ejemplo n.º 8
0
	def ejectTape(self):
		
		# TODO: Probably don't need/shouldn't call this, since it's coming from unmount
		self.sig_beginOperation.emit("Ejecting tape...")

		self.txt_log.clear()
		self.txt_log.insertPlainText("Ejecting tape\n")

		self.proc_eject = QtCore.QProcess()
		self.proc_eject.finished.connect(self.ejectSuccess)
		self.proc_eject.start("mt",["-f",self.device,"eject"])
Ejemplo n.º 9
0
 def on_click(self):
     for item in self.table.selectedItems():
         #print(item.row(), item.column(), item.text())
         if item.column() == 1:
             url = "https://" + item.text()
             #self.view = QWebEngineView()
             #self.view.load(QUrl(url))
             #self.view.show()
             browser = "firefox --new-tab " + url
             print(browser)
             self.process = QtCore.QProcess()
             self.process.start(browser)
Ejemplo n.º 10
0
def add_watcher(parm):
    """ Create a file with the current parameter contents and 
        create a file watcher, if not already created and found in hou.Session,
        add the file to the list of watched files.

        Link the file created to a parameter where the tool has been executed from
        and when the file changed, edit the parameter contents with text contents.
    """

    file_path = get_file_name(parm)

    if os.path.exists(file_path):
        os.remove(file_path)


    # fetch parm content, either raw value or expression if any
    try:
        data = parm.expression()
    except hou.OperationFailed:
        data = str(parm.eval())

    with open(file_path, 'w') as f:
        f.write(data)

    vsc = get_external_editor()
    if not vsc:
        hou.ui.setStatusMessage("No external editor set",
                                severity=hou.severityType.Error)
        return

    p = QtCore.QProcess(parent=hou.ui.mainQtWindow())
    p.start(vsc, [file_path])
    
    watcher = get_file_watcher()

    if not watcher:
    
        watcher = QtCore.QFileSystemWatcher([file_path],
                                            parent=hou.ui.mainQtWindow())
        watcher.fileChanged.connect(filechanged)
        hou.session.FILE_WATCHER = watcher

    else:
        if not file_path in watcher.files():

            watcher.addPath(file_path)

    parms_bindings = get_parm_bindings()
    if not parms_bindings:
        hou.session.PARMS_BINDINGS = {}
        parms_bindings = hou.session.PARMS_BINDINGS

    parms_bindings[file_path] = parm
Ejemplo n.º 11
0
 def call_task(self):
     if self._numbers_task_running < self.maxTask(
     ) and not self._queue.empty() and self._running:
         cmd = self._queue.get()
         process = QtCore.QProcess(self)
         process.setProcessChannelMode(QtCore.QProcess.MergedChannels)
         process.readyReadStandardOutput.connect(
             self.on_readyReadStandardOutput)
         process.finished.connect(self.on_finished)
         process.started.connect(self.on_started)
         process.errorOccurred.connect(self.on_errorOccurred)
         process.start(cmd)
Ejemplo n.º 12
0
	def bg_exec(self, command, workDir):
		# Get command argument list
		argument_list = command.split(' ')
		# Set program as argument_list[0]
		program = argument_list[0]
		# Set args as argument_list[1, -1]
		args = argument_list[1:]

		currentWorkDir = os.getcwd()
		os.chdir(workDir)
		proc = QtCore.QProcess()
		print ('\nQProcess::startDetached( ' + program + ' , ' + str(args) + ' ) @ ' + os.getcwd() + '\n')
		proc.startDetached(program, args)
		os.chdir(currentWorkDir)
Ejemplo n.º 13
0
    def __init__(self, scale_ratio=1.0, parent=None):
        QWidget.__init__(self, parent)
        self.ui = Ui_OpenALPRHotListImporter()
        self.ui.setupUi(self)
        self.resize(gui_settings.WIDTH * scale_ratio,
                    gui_settings.HEIGHT * scale_ratio)

        # Connect signals
        self.ui.comboHotlistLocation.currentIndexChanged.connect(
            self._on_hotlist_location_changed)
        self.ui.comboParser.currentIndexChanged.connect(
            self._on_parser_changed)
        self.ui.btnBrowse.released.connect(self._on_btn_browse)
        self.ui.btnViewLog.released.connect(self._on_btn_view_log)
        self.ui.btnTest.released.connect(self._on_btn_test)
        self.ui.btnSave.released.connect(self._on_btn_save)
        self.ui.chkAutoRun.toggled.connect(self._on_chk_autorun)
        self.ui.btnAddParser.released.connect(self._on_btn_add_parser_item)
        self.ui.txtCompanyID.textChanged.connect(
            lambda: validate_line_edit(self.ui.txtCompanyID))
        self.ui.txtAPIKey.textChanged.connect(
            lambda: validate_line_edit(self.ui.txtAPIKey))
        self.ui.txtHotlistLocation.textChanged.connect(
            lambda: validate_line_edit(self.ui.txtHotlistLocation))
        self.ui.txtWebServer.textChanged.connect(
            lambda: validate_line_edit(self.ui.txtWebServer))
        self.ui.btnHelpCompanyID.released.connect(
            lambda: self._on_btn_help(self.ui.txtCompanyID))
        self.ui.btnHelpAPIKey.released.connect(
            lambda: self._on_btn_help(self.ui.txtAPIKey))
        self.ui.btnHelpUrl.released.connect(
            lambda: self._on_btn_help(self.ui.txtWebServer))
        self.ui.btnHelpStateImport.released.connect(
            lambda: self._on_btn_help(self.ui.txtStateImport))
        self.ui.btnHelpPlatesToSkip.released.connect(
            lambda: self._on_btn_help(self.ui.txtSkipPlates))

        # Custom initializations
        self.ui.scrollParsersLayout.setAlignment(Qt.AlignTop)
        self.parsers = get_all_parsers()
        self._test_result_dlg = TestResultDialog()
        self._test_process = QtCore.QProcess(self)
        self._test_process.setProcessChannelMode(
            QtCore.QProcess.MergedChannels)
        self._test_process.readyReadStandardOutput.connect(
            self._on_test_data_ready)
        self._initialize()
Ejemplo n.º 14
0
    def launchExample(self, uniquename):
        if uniquename in self.runningExamples:
            return

        process = QtCore.QProcess(self)
        self.connect(process, QtCore.SIGNAL("finished(int)"), self.enableLaunching)

        self.runningExamples.append(uniquename)
        self.runningProcesses[process] = uniquename

        if self.examples[uniquename]['changedirectory'] == 'true':
            process.setWorkingDirectory(self.examples[uniquename]['absolute path'])

        process.start(sys.executable, [self.examples[uniquename]['path']])

        if process.state() == QtCore.QProcess.Starting:
            self.slideshowTimer.stop()
Ejemplo n.º 15
0
    def __init__(self, parent=None):
        super(Widget,self).__init__(parent)

        self._textedit = QtWidgets.QTextEdit(readOnly=True)
        self._lineedit = QtWidgets.QLineEdit()
        self._pushbutton = QtWidgets.QPushButton("Send")
        self._pushbutton.clicked.connect(self.on_clicked)

        lay = QtWidgets.QGridLayout(self)
        lay.addWidget(self._textedit, 0, 0, 1, 2)
        lay.addWidget(self._lineedit, 1, 0)
        lay.addWidget(self._pushbutton, 1, 1)

        self._process = QtCore.QProcess(self)
        self._process.setProcessChannelMode(QtCore.QProcess.MergedChannels)
        self._process.readyRead.connect(self.on_readReady)

        current_dir = os.path.dirname(os.path.realpath(__file__))
        self._process.start(os.path.join(current_dir, "goo"))
Ejemplo n.º 16
0
    def start_process(self):

        if self.p is None:  # No process running.
            print("start")
            self.p = QtCore.QProcess(
            )  # Keep a reference to the QProcess (e.g. on self) while it's running.
            self.p.finished.connect(
                self.process_finished)  # Clean up once complete.
            self.p.started.connect(
                self.process_started)  # Clean up once complete.
            self.view = OpenMayaUI.M3dView.active3dView()
            self.width = self.view.portWidth()
            self.height = self.view.portHeight()
            self.image = OpenMaya.MImage()
            print(self.width, self.height)
            ffmpeg = "/Applications/ffmpeg"

            command = [
                '-f',
                'rawvideo',
                '-pixel_format',
                'rgba',
                '-video_size',
                '{}x{}'.format(self.width, self.height),
                '-i',
                '-',
                '-vf',
                'vflip',  # frambuffer flipped
                #'-crf' ,'20',
                '-preset',
                'slow',
                #'-tune','animation',
                '-c:v',
                'libx264',
                #'-vcodec', 'mpeg4',
                '-y',
                '/Users/jmacey/TestMaya.mp4'
            ]
            self.p.start(ffmpeg, command)
            print(self.p.readAllStandardOutput())

            self.p.waitForFinished()
Ejemplo n.º 17
0
    def launchExample(self, name):
        executable = self.resolveExeFile(name)

        process = QtCore.QProcess(self)
        process.finished.connect(self.exampleFinished)
        process.error.connect(self.exampleError)

        if sys.platform == 'win32':
            # Make sure it finds the DLLs on Windows.
            curpath = os.getenv('PATH')
            newpath = 'PATH=%s;%s' % (QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.BinariesPath), curpath)
            process.setEnvironment([newpath])

        if self.info[name]['changedirectory'] != 'false':
            workingDirectory = self.resolveDataDir(name)
            process.setWorkingDirectory(workingDirectory)
            Colors.debug("Setting working directory:", workingDirectory)

        Colors.debug("Launching:", executable)
        process.start(sys.executable, [executable])
Ejemplo n.º 18
0
def start_process_detached(path, args=None, working_dir=None):
    """
    Uses QtCore.QProcess to start off detached processes

    :param str path: Path to the thing to start.
    :param list args: List of argument strings.
    :param str working_dir: Current Working Dir or cwd to set for the process.
    :return: Tuple of process result value and process ID.
    :rtype: tuple
    """
    if args is None:
        args = []
    if not isinstance(args, list):
        args = [args]
    if working_dir is None:
        a2 = a2core.A2Obj.inst()
        working_dir = a2.paths.a2

    process = QtCore.QProcess()
    result, pid = process.startDetached(path, args, working_dir)
    return result, pid
Ejemplo n.º 19
0
 def createProcess(self):
     self.process = QtCore.QProcess(self)
     self.process.finished.connect(self.processFinished)
Ejemplo n.º 20
0
def runProcess(command, arguments):
    process = QtCore.QProcess()
    process.start(command, arguments)
    process.waitForFinished()
    std_output = process.readAllStandardOutput().data().decode('utf-8')
    return std_output.split('\n')
Ejemplo n.º 21
0
        integrations=[
            LoggingIntegration(),
            StdlibIntegration(),
            ExcepthookIntegration(),
            DedupeIntegration(),
            AtexitIntegration(),
            ModulesIntegration(),
            ArgvIntegration(),
            ThreadingIntegration(),
        ]
    )
    instance = SingleInstance()

    while True:
        processes = (p.name() for p in psutil.process_iter())
        pw_uploader_running = "PWUploader.exe" in processes
        if not pw_uploader_running:
            process = QtCore.QProcess()
            res, pid = process.startDetached(UPLOADER_LOC, [""], "")
            if res == False:
                logging.error('Unable to start the uploader. %s', UUID)
            else:
                logging.info(f'Restarted PWUploader.exe, pid: {pid}')

            # aws?
            # TODO should send logs

        time.sleep(30)

    sys.exit(0)
Ejemplo n.º 22
0
def add_watcher(selection, type_="parm"):
    """ Create a file with the current parameter contents and 
        create a file watcher, if not already created and found in hou.Session,
        add the file to the list of watched files.

        Link the file created to a parameter where the tool has been executed from
        and when the file changed, edit the parameter contents with text contents.
    """

    file_path = get_file_name(selection, type_=type_)

    if type_ == "parm":
        # fetch parm content, either raw value or expression if any
        try:
            data = selection.expression()
        except hou.OperationFailed:
            data = str(selection.eval())
    elif type_ == "python_node":
        data = selection.type().definition().sections()["PythonCook"].contents(
        )

    elif "extra_section|" in type_:

        sec_name = type_.split('|')[-1]
        sec = selection.type().definition().sections().get(sec_name)
        if not sec:
            print("Error: No section {} found.".format(sec))
        data = sec.contents()

    elif type_ == "__temp__python_source_editor":

        data = hou.sessionModuleSource()

    with open(file_path, 'w') as f:
        f.write(data)

    vsc = get_external_editor()
    if not vsc:
        hou.ui.setStatusMessage("No external editor set",
                                severity=hou.severityType.Error)
        return

    p = QtCore.QProcess(parent=hou.ui.mainQtWindow())
    p.start(vsc, [file_path])

    watcher = get_file_watcher()

    if not watcher:

        watcher = QtCore.QFileSystemWatcher([file_path],
                                            parent=hou.ui.mainQtWindow())
        watcher.fileChanged.connect(filechanged)
        hou.session.FILE_WATCHER = watcher

    else:
        if not file_path in watcher.files():

            watcher.addPath(file_path)

    parms_bindings = get_parm_bindings()
    if not parms_bindings:
        hou.session.PARMS_BINDINGS = {}
        parms_bindings = hou.session.PARMS_BINDINGS

    if not file_path in parms_bindings.keys():

        parms_bindings[file_path] = selection

        # add "on removed" callback to remove file from watcher
        # when node is deleted
        if type_ == "python_node" or "extra_section|" in type_:

            selection.addEventCallback((hou.nodeEventType.BeingDeleted, ),
                                       _node_deleted)

    clean_files()
Ejemplo n.º 23
0
	def getDriveStatus(self):
		self.txt_log.append("Checking drive...")
		self.proc_status = QtCore.QProcess()
		self.proc_status.finished.connect(self.driveStatusSuccess)
		self.proc_status.start("mt",["-f", self.device, "status"])
Ejemplo n.º 24
0
    def __init__(
        self,
        appName,
        x64Client,
        argTemplate,
        account,
        server,
        ticket,
        chatServer,
        language,
        runDir,
        wineProgram,
        wineDebug,
        winePrefix,
        hiResEnabled,
        builtInPrefixEnabled,
        osType,
        homeDir,
        iconFileIn,
        crashreceiver,
        DefaultUploadThrottleMbps,
        bugurl,
        authserverurl,
        supporturl,
        supportserviceurl,
        glsticketlifetime,
        worldName,
        accountText,
        parent,
        data_folder,
        startupScripts,
        gameConfigDir,
    ):

        # Fixes binary path for 64-bit client
        if x64Client:
            appName = "x64" + os.sep + appName

        self.homeDir = homeDir
        self.osType = osType
        self.worldName = worldName
        self.accountText = accountText
        self.parent = parent
        self.logger = logging.getLogger("OneLauncher")
        self.startupScripts = startupScripts
        self.gameConfigDirPath = os.path.join(osType.documentsDir,
                                              gameConfigDir)

        ui_file = QtCore.QFile(os.path.join(data_folder, "ui", "winLog.ui"))
        ui_file.open(QtCore.QFile.ReadOnly)
        loader = QUiLoader()
        self.winLog = loader.load(ui_file, parentWidget=parent)
        ui_file.close()

        self.winLog.setWindowFlags(QtCore.Qt.Dialog
                                   | QtCore.Qt.FramelessWindowHint)

        if self.osType.usingWindows:
            self.winLog.setWindowTitle("Output")
        else:
            self.winLog.setWindowTitle("Launch Game - Wine output")

        # self.winLog.btnStart.setVisible(False)
        self.winLog.btnStart.setText("Back")
        self.winLog.btnStart.setEnabled(False)
        self.winLog.btnSave.setText("Save")
        self.winLog.btnSave.setEnabled(False)
        self.winLog.btnStop.setText("Exit")
        self.winLog.btnStart.clicked.connect(self.btnStartClicked)
        self.winLog.btnSave.clicked.connect(self.btnSaveClicked)
        self.winLog.btnStop.clicked.connect(self.btnStopClicked)

        self.aborted = False
        self.finished = False
        self.command = ""
        self.arguments = []

        gameParams = (argTemplate.replace("{SUBSCRIPTION}", account).replace(
            "{LOGIN}", server).replace("{GLS}", ticket).replace(
                "{CHAT}", chatServer).replace("{LANG}", language).replace(
                    "{CRASHRECEIVER}", crashreceiver).replace(
                        "{UPLOADTHROTTLE}", DefaultUploadThrottleMbps).replace(
                            "{BUGURL}",
                            bugurl).replace("{AUTHSERVERURL}",
                                            authserverurl).replace(
                                                "{GLSTICKETLIFETIME}",
                                                glsticketlifetime).replace(
                                                    "{SUPPORTURL}",
                                                    supporturl).replace(
                                                        "{SUPPORTSERVICEURL}",
                                                        supportserviceurl))

        if not hiResEnabled:
            gameParams = gameParams + " --HighResOutOfDate"

        self.process = QtCore.QProcess()
        self.process.readyReadStandardOutput.connect(self.readOutput)
        self.process.readyReadStandardError.connect(self.readErrors)
        self.process.finished.connect(self.resetButtons)

        if self.osType.usingWindows:
            self.command = appName
            self.process.setWorkingDirectory(runDir)

            os.chdir(runDir)

            for arg in gameParams.split(" "):
                self.arguments.append(arg)

        else:
            processEnvironment = QtCore.QProcessEnvironment.systemEnvironment()

            if wineDebug != "":
                processEnvironment.insert("WINEDEBUG", wineDebug)

            if winePrefix != "":
                processEnvironment.insert("WINEPREFIX", winePrefix)

            self.command = wineProgram
            self.process.setWorkingDirectory(runDir)

            self.arguments.append(appName)

            for arg in gameParams.split(" "):
                self.arguments.append(arg)

            # Applies needed settings for the builtin wine prefix
            if builtInPrefixEnabled:
                # Enables esync if open file limit is high enough
                if os.path.exists("/proc/sys/fs/file-max"):
                    with open("/proc/sys/fs/file-max") as file:
                        file_data = file.read()
                        if int(file_data) >= 524288:
                            processEnvironment.insert("WINEESYNC", "1")

                # Adds dll overrides for directx, so dxvk is used instead of wine3d
                processEnvironment.insert("WINEDLLOVERRIDES",
                                          "d3d11=n;dxgi=n;d3d10=n")

            self.process.setProcessEnvironment(processEnvironment)

        self.winLog.txtLog.append("Connecting to server: " + worldName)
        self.winLog.txtLog.append("Account: " + accountText)
        self.winLog.txtLog.append("Game Directory: " + runDir)
        self.winLog.txtLog.append("Game Client: " + appName)

        self.winLog.show()

        self.runStatupScripts()
Ejemplo n.º 25
0
    def __init__(self, parent = None):
        QtGui.QMainWindow.__init__(self, parent)

        self.categories = {}
        self.runningProcesses = {}
        self.examples = {}
        self.runningExamples = []
        self.titleFont = QtGui.QFont(self.font())
        self.titleFont.setWeight(QtGui.QFont.Bold)
        self.fontRatio = 0.8
        self.documentFont = self.font()
        self.inFullScreenResize = False
        self.currentCategory = "[starting]"
        self.qtLogo = QtGui.QImage()
        self.rbLogo = QtGui.QImage()
        self.currentExample = ""
        self.assistantProcess = QtCore.QProcess()

        parentPageAction1 = QtGui.QAction(self.tr("Show Parent Page"), self)
        parentPageAction2 = QtGui.QAction(self.tr("Show Parent Page"), self)
        parentPageAction3 = QtGui.QAction(self.tr("Show Parent Page"), self)
        parentPageAction1.setShortcut(QtGui.QKeySequence(self.tr("Escape")))
        parentPageAction2.setShortcut(QtGui.QKeySequence(self.tr("Backspace")))
        parentPageAction3.setShortcut(QtGui.QKeySequence(self.tr("Alt+Left")))

        fullScreenAction = QtGui.QAction(self.tr("Toggle &Full Screen"), self)
        fullScreenAction.setShortcut(QtGui.QKeySequence(self.tr("Ctrl+F")))

        exitAction = QtGui.QAction(self.tr("E&xit"), self)
        exitAction.setShortcut(QtGui.QKeySequence(self.tr("Ctrl+Q")))

        self.connect(parentPageAction1, QtCore.SIGNAL("triggered()"), self, QtCore.SIGNAL("showPage()"))
        self.connect(parentPageAction2, QtCore.SIGNAL("triggered()"), self, QtCore.SIGNAL("showPage()"))
        self.connect(parentPageAction3, QtCore.SIGNAL("triggered()"), self, QtCore.SIGNAL("showPage()"))
        self.connect(fullScreenAction, QtCore.SIGNAL("triggered()"), self.toggleFullScreen)
        self.connect(exitAction, QtCore.SIGNAL("triggered()"), self.close)

        self.display = DisplayWidget()

        self.addAction(parentPageAction1)
        self.addAction(parentPageAction2)
        self.addAction(parentPageAction3)
        self.addAction(fullScreenAction)
        self.addAction(exitAction)

        self.slideshowTimer = QtCore.QTimer(self)
        self.slideshowTimer.setInterval(5000)
        self.resizeTimer = QtCore.QTimer(self)
        self.resizeTimer.setSingleShot(True)
        self.connect(self.resizeTimer, QtCore.SIGNAL("timeout()"), self.redisplayWindow)

        self.connect(self.display, QtCore.SIGNAL("actionRequested"),
                     self.executeAction)
        self.connect(self.display, QtCore.SIGNAL("categoryRequested"),
                     self.showExamples)
        self.connect(self.display, QtCore.SIGNAL("documentationRequested"),
                     self.showExampleDocumentation)
        self.connect(self.display, QtCore.SIGNAL("exampleRequested"),
                     self.showExampleSummary)

        self.connect(self.display, QtCore.SIGNAL("launchRequested"),
                     self.launchExample)

        self.connect(self, QtCore.SIGNAL("showPage()"), self.showParentPage,
                QtCore.Qt.QueuedConnection)
        self.connect(self, QtCore.SIGNAL("windowResized()"), self.redisplayWindow,
                QtCore.Qt.QueuedConnection)

        self.setCentralWidget(self.display)
        self.setMaximumSize(QtGui.QApplication.desktop().screenGeometry().size())
        self.setWindowTitle(self.tr("PyQt Examples and Demos"))
        self.setWindowIcon(QtGui.QIcon(QtGui.QPixmap(":/images/qt4-logo.png")))
Ejemplo n.º 26
0
    def __init__(
        self,
        urlPatchServer,
        prodCode,
        language,
        runDir,
        patchClient,
        wineProgram,
        hiResEnabled,
        iconFileIn,
        homeDir,
        winePrefix,
        wineDebug,
        osType,
        parent,
        data_folder,
        current_game,
        gameDocumentsDir,
    ):

        self.homeDir = homeDir
        self.osType = osType
        self.logger = logging.getLogger("OneLauncher")

        ui_file = QtCore.QFile(os.path.join(data_folder, "ui", "winPatch.ui"))
        ui_file.open(QtCore.QFile.ReadOnly)
        loader = QUiLoader()
        self.winLog = loader.load(ui_file, parentWidget=parent)
        ui_file.close()

        self.winLog.setWindowFlags(QtCore.Qt.Dialog
                                   | QtCore.Qt.FramelessWindowHint)

        if self.osType.usingWindows:
            self.winLog.setWindowTitle("Output")
        else:
            self.winLog.setWindowTitle("Patch - Wine output")

        self.winLog.btnSave.setText("Save Log")
        self.winLog.btnSave.setEnabled(False)
        self.winLog.progressBar.reset()
        self.winLog.btnStop.setText("Close")
        self.winLog.btnStart.setText("Patch")
        self.winLog.btnSave.clicked.connect(self.btnSaveClicked)
        self.winLog.btnStop.clicked.connect(self.btnStopClicked)
        self.winLog.btnStart.clicked.connect(self.btnStartClicked)

        self.aborted = False
        self.finished = True
        self.lastRun = False
        self.command = ""
        self.arguments = []

        self.process_status_timer = QtCore.QTimer()
        self.process_status_timer.timeout.connect(
            self.activelyShowProcessStatus)

        patchClient = os.path.join(runDir, patchClient)
        # Fix for the at least one person who has a title case patchclient.dll
        if os.path.split(patchClient)[
                1] == "patchclient.dll" and not os.path.exists(patchClient):
            patchClient = os.path.join(runDir, "PatchClient.dll")

        # Make sure patchClient exists
        if not os.path.exists(patchClient):
            self.winLog.txtLog.append(
                '<font color="Khaki">Patch client %s not found</font>' %
                (patchClient))
            self.logger.error("Patch client %s not found" % (patchClient))
            return

        self.progressMonitor = ProgressMonitor(self.winLog)

        self.process = QtCore.QProcess()
        self.process.readyReadStandardOutput.connect(self.readOutput)
        self.process.readyReadStandardError.connect(self.readErrors)
        self.process.finished.connect(self.processFinished)

        processEnvironment = QtCore.QProcessEnvironment.systemEnvironment()

        if self.osType.usingWindows:
            self.arguments = [
                patchClient,
                "Patch",
                urlPatchServer,
                "--language",
                language,
                "--productcode",
                prodCode,
            ]

            self.command = "rundll32.exe"

            # Get log file to read patching details from, since
            # rundll32 doesn't provide output on Windows
            log_folder_name = gameDocumentsDir

            game_logs_folder = os.path.join(
                os.path.split(os.environ.get("APPDATA"))[0],
                "Local",
                log_folder_name,
            )

            self.patch_log_file = os.path.join(game_logs_folder,
                                               "PatchClient.log")
            if os.path.exists(self.patch_log_file):
                os.remove(self.patch_log_file)
                open(self.patch_log_file, "x")
            self.patch_log_file = open(self.patch_log_file, "r")
        else:
            if winePrefix != "":
                processEnvironment.insert("WINEPREFIX", winePrefix)

            if wineDebug != "":
                processEnvironment.insert("WINEDEBUG", wineDebug)

            self.arguments = [
                "rundll32.exe",
                patchClient,
                "Patch",
                urlPatchServer,
                "--language",
                language,
                "--productcode",
                prodCode,
            ]

            self.command = wineProgram

        self.process.setProcessEnvironment(processEnvironment)
        self.process.setWorkingDirectory(runDir)

        if hiResEnabled:
            self.arguments.append("--highres")

        self.file_arguments = self.arguments.copy()
        self.file_arguments.append("--filesonly")