Refactory run
This commit is contained in:
parent
cfb99b335c
commit
d61daff685
|
@ -3470,16 +3470,6 @@ def merge_zip(target, zips):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def get_size_screen():
|
|
||||||
if IS_WIN:
|
|
||||||
user32 = ctypes.windll.user32
|
|
||||||
res = '{}x{}'.format(user32.GetSystemMetrics(0), user32.GetSystemMetrics(1))
|
|
||||||
else:
|
|
||||||
args = 'xrandr | grep "*" | cut -d " " -f4'
|
|
||||||
res = run(args, True)
|
|
||||||
return res.strip()
|
|
||||||
|
|
||||||
|
|
||||||
# ~ Export ok
|
# ~ Export ok
|
||||||
def format(template, data):
|
def format(template, data):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -534,7 +534,10 @@ def call_macro(args, in_thread=False):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def run(command, capture=False):
|
def run(command, capture=False, split=True):
|
||||||
|
if not split:
|
||||||
|
return subprocess.check_output(command, shell=True).decode()
|
||||||
|
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
result = subprocess.run(cmd, capture_output=capture, text=True)
|
result = subprocess.run(cmd, capture_output=capture, text=True)
|
||||||
if capture:
|
if capture:
|
||||||
|
@ -672,6 +675,16 @@ def render(template, data):
|
||||||
return s.safe_substitute(**data)
|
return s.safe_substitute(**data)
|
||||||
|
|
||||||
|
|
||||||
|
def get_size_screen():
|
||||||
|
if IS_WIN:
|
||||||
|
user32 = ctypes.windll.user32
|
||||||
|
res = f'{user32.GetSystemMetrics(0)}x{user32.GetSystemMetrics(1)}'
|
||||||
|
else:
|
||||||
|
args = 'xrandr | grep "*" | cut -d " " -f4'
|
||||||
|
res = run(args, split=False)
|
||||||
|
return res.strip()
|
||||||
|
|
||||||
|
|
||||||
def _get_key(password):
|
def _get_key(password):
|
||||||
from cryptography.hazmat.primitives import hashes
|
from cryptography.hazmat.primitives import hashes
|
||||||
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
|
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
|
||||||
|
|
Loading…
Reference in New Issue