|
|
@ -1,4 +1,7 @@
|
|
|
|
|
|
|
|
import os
|
|
|
|
import time
|
|
|
|
import time
|
|
|
|
|
|
|
|
import win32api
|
|
|
|
|
|
|
|
import shutil
|
|
|
|
|
|
|
|
|
|
|
|
from pywinauto import Application
|
|
|
|
from pywinauto import Application
|
|
|
|
|
|
|
|
|
|
|
@ -22,6 +25,13 @@ class AppletApplication(BaseApplication):
|
|
|
|
self.pid = None
|
|
|
|
self.pid = None
|
|
|
|
self.app = None
|
|
|
|
self.app = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def launch(self):
|
|
|
|
|
|
|
|
win_user_name = win32api.GetUserName()
|
|
|
|
|
|
|
|
src_driver = os.path.join(os.path.dirname(self.path), 'drivers')
|
|
|
|
|
|
|
|
dest_driver = r'C:\Users\%s\AppData\Roaming\DBeaverData\drivers' % win_user_name
|
|
|
|
|
|
|
|
if not os.path.exists(dest_driver):
|
|
|
|
|
|
|
|
shutil.copytree(src_driver, dest_driver, dirs_exist_ok=True)
|
|
|
|
|
|
|
|
|
|
|
|
def _get_exec_params(self):
|
|
|
|
def _get_exec_params(self):
|
|
|
|
driver = getattr(self, 'driver', self.protocol)
|
|
|
|
driver = getattr(self, 'driver', self.protocol)
|
|
|
|
params_string = f'name={self.name}|' \
|
|
|
|
params_string = f'name={self.name}|' \
|
|
|
@ -50,6 +60,7 @@ class AppletApplication(BaseApplication):
|
|
|
|
return self._get_exec_params()
|
|
|
|
return self._get_exec_params()
|
|
|
|
|
|
|
|
|
|
|
|
def run(self):
|
|
|
|
def run(self):
|
|
|
|
|
|
|
|
self.launch()
|
|
|
|
self.app = Application(backend='uia')
|
|
|
|
self.app = Application(backend='uia')
|
|
|
|
|
|
|
|
|
|
|
|
function = getattr(self, '_get_%s_exec_params' % self.protocol, None)
|
|
|
|
function = getattr(self, '_get_%s_exec_params' % self.protocol, None)
|
|
|
@ -57,7 +68,8 @@ class AppletApplication(BaseApplication):
|
|
|
|
params = self._get_exec_params()
|
|
|
|
params = self._get_exec_params()
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
params = function()
|
|
|
|
params = function()
|
|
|
|
self.app.start('%s -con %s' % (self.path, params), wait_for_idle=False)
|
|
|
|
exec_string = '%s -con %s' % (self.path, params)
|
|
|
|
|
|
|
|
self.app.start(exec_string, wait_for_idle=False)
|
|
|
|
self.pid = self.app.process
|
|
|
|
self.pid = self.app.process
|
|
|
|
|
|
|
|
|
|
|
|
def wait(self):
|
|
|
|
def wait(self):
|
|
|
|