def open_file(self): file_address = self.lineedit1.text() if file_address: print('ctype', file_address) try: win32api.ShellExecute(0, 'open', file_address, None, None, 1) except: QtWidgets.QMessageBox.warning(self, 'Warning', '파일 위치를 확인하십시오.', QtWidgets.QMessageBox.Yes, QtWidgets.QMessageBox.Yes) else: QtWidgets.QMessageBox.warning(self, 'Warning', '먼저 파일을 불러오십시오.', QtWidgets.QMessageBox.Yes, QtWidgets.QMessageBox.Yes)
def run_update(self, autorun=False): if self.isdownload: if autorun: param = '/S /autorun' else: param = '/S' if self.info['update']['isbeta']: out = 'MDFSetup-beta.exe' else: out = 'MDFSetup-stable.exe' win32api.ShellExecute( None, "open", os.path.dirname(self.download_file_name) + '\\{}'.format(out), param, None, 1) sys.exit()
def download(self, beta=False): if beta: utype = 'stable-release' ref = self.beta_tags out = 'MDFSetup-stable.exe' else: utype = 'stable-release' ref = self.tags out = 'MDFSetup-stable.exe' uinfo = self.info['update'] uinfo["isnew"] = True uinfo['isbeta'] = beta self.commit_info() if PRODUCT_CONFIG['UPDATE_URL']: try: r = requests.get(PRODUCT_CONFIG['UPDATE_URL'].format( ref, utype)) r.raise_for_status() except: sys.exit() os.makedirs(os.path.dirname(self.download_file_name), exist_ok=True) with open(self.download_file_name, 'wb') as f: f.write(r.content) _zip = zipfile.ZipFile(self.download_file_name) _zip.extractall(os.path.dirname(self.download_file_name)) win32api.ShellExecute( None, "open", os.path.dirname(self.download_file_name) + '\\{}'.format(out), '/S /init', None, 1) uinfo["download"] = True self.commit_info()
def appStart(self, fileext, ver): win32api.ShellExecute(0, 'open', fileext, ver, '', 1) time.sleep(5) self.k.type_string(self.password) win32api.keybd_event(VK_CODE['tab'], 0, 0, 0) win32api.keybd_event(VK_CODE['enter'], 0, 0, 0)
def printer(file): logger.loggerprint("开始打印功能,打印的是:") logger.loggerprint(file) filename = file win32api.ShellExecute(0, "print", filename, '/d:"%s"' % win32print.GetDefaultPrinter(), ".", 0)
def show_SL(self): url = 'https://mgylabs.gitlab.io/mulgyeol-distance-fetcher/LICENSE' if (PRODUCT_CONFIG['LICENSE_URL'] != None) and (PRODUCT_CONFIG['LICENSE_URL'] != url): url = PRODUCT_CONFIG['LICENSE_URL'] win32api.ShellExecute(0, 'open', url, None, None, 1)
def show_OSL(self): win32api.ShellExecute( 0, 'open', 'https://mgylabs.gitlab.io/mulgyeol-distance-fetcher/OpenSourceLicense.txt', None, None, 1)
def show_json(self): win32api.ShellExecute(0, 'open', '..\\data\\settings\\settings.json', None, ".", 1)
def show_release_info(self): win32api.ShellExecute( 0, 'open', 'https://github.com/MycroftKang/mulgyeol-distance-fetcher/releases', None, None, 1)
def printbill(): ''' Print the text file in pdf ''' win32api.ShellExecute(0, "print", 'bill.txt', '/d:"%s"' % win32print.GetDefaultPrinter(), ".", 0) ShellExecute
def run_update_with_autorun(self): if getattr(sys, 'frozen', False): win32api.ShellExecute(None, "open", 'Update.exe', '/ruwa', None, 1) else: print('Call Run_Update_With_Autorun')
def run_update(self): if getattr(sys, 'frozen', False): win32api.ShellExecute(None, "open", 'Update.exe', '/ru', None, 1) else: print('Call Run_Update')
async def printFiles(filesToPrint): for file in filesToPrint: win32api.ShellExecute(0, "print", file, '"%s"' % win32print.GetDefaultPrinter(), ".", 0)