Add dependencies

main
Micke Nordin 4 years ago
parent 978908e5af
commit 167cd75f6f

@ -1,10 +1,10 @@
#!/usr/bin/env bash #!/usr/bin/env bash
if [[ -f /usr/bin/apk ]]; then # PostmarketOS/Alpine if [[ -f /usr/bin/apk ]]; then # PostmarketOS/Alpine
sudo apk add py3-wxpython sudo apk add py3-wxpython git gnupg pass
elif [[ -f /usr/bin/apt ]]; then # Mobian/Debian/Ubuntu elif [[ -f /usr/bin/apt ]]; then # Mobian/Debian/Ubuntu
sudo apt install python3-wxgtk4.0 sudo apt install python3-wxgtk4.0 git gnupg pass
elif [[ -f /usr/bin/dnf ]]; then # Fedora elif [[ -f /usr/bin/dnf ]]; then # Fedora
sudo dnf install python3-wxpython4 sudo dnf install python3-wxpython4 git gnupg pass
fi fi
sudo cp passui /usr/local/bin/ sudo cp passui /usr/local/bin/
sudo cp passui.desktop /usr/share/applications/ sudo cp passui.desktop /usr/share/applications/

@ -32,6 +32,7 @@ class PassUi(wx.Frame):
def add_buttons(self): def add_buttons(self):
self.sizer.Clear(delete_windows=True) self.sizer.Clear(delete_windows=True)
self.add_push_pull()
if self.curdir != self.topdir: if self.curdir != self.topdir:
index = -1 index = -1
cpath = os.path.abspath(os.path.join(self.curdir, os.pardir)) cpath = os.path.abspath(os.path.join(self.curdir, os.pardir))
@ -65,6 +66,15 @@ class PassUi(wx.Frame):
index = index + 1 index = index + 1
self.sizer.Layout() self.sizer.Layout()
def add_push_pull(self):
pushbtn = wx.Button(self.pnl, label="Push to remote")
self.sizer.Add(pushbtn, 0, wx.EXPAND) # pylint: disable=no-member
self.Bind(wx.EVT_BUTTON,lambda event: pass_push(event),pushbtn)
pullbtn = wx.Button(self.pnl, label="Pull from remote")
self.sizer.Add(pullbtn, 0, wx.EXPAND) # pylint: disable=no-member
self.Bind(wx.EVT_BUTTON,lambda event: pass_pull(event),pullbtn)
def get_pass_path_from_index(self, index, pathtype="path"): def get_pass_path_from_index(self, index, pathtype="path"):
result = "" result = ""
if pathtype == "password": if pathtype == "password":
@ -104,6 +114,7 @@ class PassUi(wx.Frame):
def show_password_dialog(self, index): def show_password_dialog(self, index):
self.sizer.Clear(delete_windows=True) self.sizer.Clear(delete_windows=True)
self.add_push_pull()
cpath = os.path.abspath(os.path.join(self.curdir, os.pardir)) cpath = os.path.abspath(os.path.join(self.curdir, os.pardir))
label = '../' label = '../'
@ -130,6 +141,7 @@ class PassUi(wx.Frame):
def show_password(self, event, index): def show_password(self, event, index):
self.sizer.Clear(delete_windows=True) self.sizer.Clear(delete_windows=True)
self.add_push_pull()
cpath = os.path.abspath(os.path.join(self.curdir, os.pardir)) cpath = os.path.abspath(os.path.join(self.curdir, os.pardir))
label = '../' label = '../'
@ -169,10 +181,10 @@ def get_password_from_path(passpath):
password = temp.split('\n')[0] password = temp.split('\n')[0]
return password return password
def pass_pull(): def pass_pull(event):
result = run_command('/usr/bin/pass git pull') result = run_command('/usr/bin/pass git pull')
def pass_push(): def pass_push(event):
result = run_command('/usr/bin/pass git push') result = run_command('/usr/bin/pass git push')
def run_command(command1, command2=None): def run_command(command1, command2=None):
@ -193,7 +205,6 @@ def run_command(command1, command2=None):
def save_to_pass(event, path, text): def save_to_pass(event, path, text):
password = text.GetLineText(0) password = text.GetLineText(0)
print(password)
command1 = '/bin/echo ' + password command1 = '/bin/echo ' + password
command2 = '/usr/bin/pass insert -m ' + path command2 = '/usr/bin/pass insert -m ' + path
result = run_command(command1, command2) result = run_command(command1, command2)

Loading…
Cancel
Save