Install with file requeriments.txt
This commit is contained in:
parent
3d10072e9a
commit
475840d7e8
|
@ -4207,14 +4207,10 @@ class Paths(object):
|
||||||
return cls.to_system(getattr(path, name))
|
return cls.to_system(getattr(path, name))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get(cls, init_dir='', filters=()):
|
def get(cls, init_dir='', filters: str=''):
|
||||||
"""
|
"""
|
||||||
Options: http://api.libreoffice.org/docs/idl/ref/namespacecom_1_1sun_1_1star_1_1ui_1_1dialogs_1_1TemplateDescription.html
|
Options: http://api.libreoffice.org/docs/idl/ref/namespacecom_1_1sun_1_1star_1_1ui_1_1dialogs_1_1TemplateDescription.html
|
||||||
filters: Example
|
filters: 'xml' or 'txt,xml'
|
||||||
(
|
|
||||||
('XML', '*.xml'),
|
|
||||||
('TXT', '*.txt'),
|
|
||||||
)
|
|
||||||
"""
|
"""
|
||||||
if not init_dir:
|
if not init_dir:
|
||||||
init_dir = cls.documents
|
init_dir = cls.documents
|
||||||
|
@ -4224,6 +4220,7 @@ class Paths(object):
|
||||||
file_picker.setDisplayDirectory(init_dir)
|
file_picker.setDisplayDirectory(init_dir)
|
||||||
file_picker.initialize((2,))
|
file_picker.initialize((2,))
|
||||||
if filters:
|
if filters:
|
||||||
|
filters = [(f.upper(), f'*.{f.lower()}') for f in filters.split(',')]
|
||||||
file_picker.setCurrentFilter(filters[0][0])
|
file_picker.setCurrentFilter(filters[0][0])
|
||||||
for f in filters:
|
for f in filters:
|
||||||
file_picker.appendFilter(f[0], f[1])
|
file_picker.appendFilter(f[0], f[1])
|
||||||
|
|
Binary file not shown.
|
@ -4207,14 +4207,10 @@ class Paths(object):
|
||||||
return cls.to_system(getattr(path, name))
|
return cls.to_system(getattr(path, name))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get(cls, init_dir='', filters=()):
|
def get(cls, init_dir='', filters: str=''):
|
||||||
"""
|
"""
|
||||||
Options: http://api.libreoffice.org/docs/idl/ref/namespacecom_1_1sun_1_1star_1_1ui_1_1dialogs_1_1TemplateDescription.html
|
Options: http://api.libreoffice.org/docs/idl/ref/namespacecom_1_1sun_1_1star_1_1ui_1_1dialogs_1_1TemplateDescription.html
|
||||||
filters: Example
|
filters: 'xml' or 'txt,xml'
|
||||||
(
|
|
||||||
('XML', '*.xml'),
|
|
||||||
('TXT', '*.txt'),
|
|
||||||
)
|
|
||||||
"""
|
"""
|
||||||
if not init_dir:
|
if not init_dir:
|
||||||
init_dir = cls.documents
|
init_dir = cls.documents
|
||||||
|
@ -4224,6 +4220,7 @@ class Paths(object):
|
||||||
file_picker.setDisplayDirectory(init_dir)
|
file_picker.setDisplayDirectory(init_dir)
|
||||||
file_picker.initialize((2,))
|
file_picker.initialize((2,))
|
||||||
if filters:
|
if filters:
|
||||||
|
filters = [(f.upper(), f'*.{f.lower()}') for f in filters.split(',')]
|
||||||
file_picker.setCurrentFilter(filters[0][0])
|
file_picker.setCurrentFilter(filters[0][0])
|
||||||
for f in filters:
|
for f in filters:
|
||||||
file_picker.appendFilter(f[0], f[1])
|
file_picker.appendFilter(f[0], f[1])
|
||||||
|
|
|
@ -207,14 +207,18 @@ class Controllers(object):
|
||||||
return
|
return
|
||||||
|
|
||||||
@app.run_in_thread
|
@app.run_in_thread
|
||||||
def _install(self, value):
|
def _install(self, value: str='', path: str=''):
|
||||||
self._set_state('install')
|
self._set_state('install')
|
||||||
self.d.lst_package.visible = False
|
self.d.lst_package.visible = False
|
||||||
self.d.lst_log.visible = True
|
self.d.lst_log.visible = True
|
||||||
|
|
||||||
line = ''
|
line = ''
|
||||||
name = value.split(' ')[0].strip()
|
cmd = ' install --upgrade --user'
|
||||||
cmd = self._cmd_pip(' install --upgrade --user {}'.format(name))
|
if value:
|
||||||
|
name = value.split(' ')[0].strip()
|
||||||
|
cmd = self._cmd_pip(f'{cmd} {name}')
|
||||||
|
else:
|
||||||
|
cmd = self._cmd_pip(f'{cmd} -r "{path}"')
|
||||||
self.d.lst_log.clear()
|
self.d.lst_log.clear()
|
||||||
for line in app.popen(cmd):
|
for line in app.popen(cmd):
|
||||||
if self.OK1 in line or self.OK2 in line:
|
if self.OK1 in line or self.OK2 in line:
|
||||||
|
@ -223,7 +227,6 @@ class Controllers(object):
|
||||||
self.d.lst_log.insert(line)
|
self.d.lst_log.insert(line)
|
||||||
return
|
return
|
||||||
|
|
||||||
@app.catch_exception
|
|
||||||
def lst_package_double_click(self, event):
|
def lst_package_double_click(self, event):
|
||||||
opt = 'install'
|
opt = 'install'
|
||||||
if self._states['list']:
|
if self._states['list']:
|
||||||
|
@ -285,9 +288,15 @@ class Controllers(object):
|
||||||
|
|
||||||
@app.catch_exception
|
@app.catch_exception
|
||||||
def cmd_explore_action(self, event):
|
def cmd_explore_action(self, event):
|
||||||
file_name = app.paths.get_file(filters='txt')
|
path = app.paths.get_file(filters='txt')
|
||||||
self.d.txt_search.value = file_name
|
if not path:
|
||||||
app.debug(file_name)
|
return
|
||||||
|
|
||||||
|
msg = _(f'Confirm install from:\n\n{path}')
|
||||||
|
if not app.question(msg):
|
||||||
|
return
|
||||||
|
|
||||||
|
self._install(path=path)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue