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))
|
||||
|
||||
@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
|
||||
filters: Example
|
||||
(
|
||||
('XML', '*.xml'),
|
||||
('TXT', '*.txt'),
|
||||
)
|
||||
filters: 'xml' or 'txt,xml'
|
||||
"""
|
||||
if not init_dir:
|
||||
init_dir = cls.documents
|
||||
|
@ -4224,6 +4220,7 @@ class Paths(object):
|
|||
file_picker.setDisplayDirectory(init_dir)
|
||||
file_picker.initialize((2,))
|
||||
if filters:
|
||||
filters = [(f.upper(), f'*.{f.lower()}') for f in filters.split(',')]
|
||||
file_picker.setCurrentFilter(filters[0][0])
|
||||
for f in filters:
|
||||
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))
|
||||
|
||||
@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
|
||||
filters: Example
|
||||
(
|
||||
('XML', '*.xml'),
|
||||
('TXT', '*.txt'),
|
||||
)
|
||||
filters: 'xml' or 'txt,xml'
|
||||
"""
|
||||
if not init_dir:
|
||||
init_dir = cls.documents
|
||||
|
@ -4224,6 +4220,7 @@ class Paths(object):
|
|||
file_picker.setDisplayDirectory(init_dir)
|
||||
file_picker.initialize((2,))
|
||||
if filters:
|
||||
filters = [(f.upper(), f'*.{f.lower()}') for f in filters.split(',')]
|
||||
file_picker.setCurrentFilter(filters[0][0])
|
||||
for f in filters:
|
||||
file_picker.appendFilter(f[0], f[1])
|
||||
|
|
|
@ -207,14 +207,18 @@ class Controllers(object):
|
|||
return
|
||||
|
||||
@app.run_in_thread
|
||||
def _install(self, value):
|
||||
def _install(self, value: str='', path: str=''):
|
||||
self._set_state('install')
|
||||
self.d.lst_package.visible = False
|
||||
self.d.lst_log.visible = True
|
||||
|
||||
line = ''
|
||||
name = value.split(' ')[0].strip()
|
||||
cmd = self._cmd_pip(' install --upgrade --user {}'.format(name))
|
||||
cmd = ' install --upgrade --user'
|
||||
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()
|
||||
for line in app.popen(cmd):
|
||||
if self.OK1 in line or self.OK2 in line:
|
||||
|
@ -223,7 +227,6 @@ class Controllers(object):
|
|||
self.d.lst_log.insert(line)
|
||||
return
|
||||
|
||||
@app.catch_exception
|
||||
def lst_package_double_click(self, event):
|
||||
opt = 'install'
|
||||
if self._states['list']:
|
||||
|
@ -285,9 +288,15 @@ class Controllers(object):
|
|||
|
||||
@app.catch_exception
|
||||
def cmd_explore_action(self, event):
|
||||
file_name = app.paths.get_file(filters='txt')
|
||||
self.d.txt_search.value = file_name
|
||||
app.debug(file_name)
|
||||
path = app.paths.get_file(filters='txt')
|
||||
if not path:
|
||||
return
|
||||
|
||||
msg = _(f'Confirm install from:\n\n{path}')
|
||||
if not app.question(msg):
|
||||
return
|
||||
|
||||
self._install(path=path)
|
||||
return
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue