From 167cd75f6fcb70b58724f98b7dd8083477e4383e Mon Sep 17 00:00:00 2001 From: Micke Nordin Date: Thu, 4 Feb 2021 10:44:35 +0100 Subject: [PATCH] Add dependencies --- src/install.sh | 6 +++--- src/passui | 17 ++++++++++++++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/install.sh b/src/install.sh index 42ef31a..c9b5e7d 100755 --- a/src/install.sh +++ b/src/install.sh @@ -1,10 +1,10 @@ #!/usr/bin/env bash 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 - sudo apt install python3-wxgtk4.0 + sudo apt install python3-wxgtk4.0 git gnupg pass elif [[ -f /usr/bin/dnf ]]; then # Fedora - sudo dnf install python3-wxpython4 + sudo dnf install python3-wxpython4 git gnupg pass fi sudo cp passui /usr/local/bin/ sudo cp passui.desktop /usr/share/applications/ diff --git a/src/passui b/src/passui index 5ee734e..91c2d53 100755 --- a/src/passui +++ b/src/passui @@ -32,6 +32,7 @@ class PassUi(wx.Frame): def add_buttons(self): self.sizer.Clear(delete_windows=True) + self.add_push_pull() if self.curdir != self.topdir: index = -1 cpath = os.path.abspath(os.path.join(self.curdir, os.pardir)) @@ -65,6 +66,15 @@ class PassUi(wx.Frame): index = index + 1 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"): result = "" if pathtype == "password": @@ -104,6 +114,7 @@ class PassUi(wx.Frame): def show_password_dialog(self, index): self.sizer.Clear(delete_windows=True) + self.add_push_pull() cpath = os.path.abspath(os.path.join(self.curdir, os.pardir)) label = '../' @@ -130,6 +141,7 @@ class PassUi(wx.Frame): def show_password(self, event, index): self.sizer.Clear(delete_windows=True) + self.add_push_pull() cpath = os.path.abspath(os.path.join(self.curdir, os.pardir)) label = '../' @@ -169,10 +181,10 @@ def get_password_from_path(passpath): password = temp.split('\n')[0] return password -def pass_pull(): +def pass_pull(event): result = run_command('/usr/bin/pass git pull') -def pass_push(): +def pass_push(event): result = run_command('/usr/bin/pass git push') def run_command(command1, command2=None): @@ -193,7 +205,6 @@ def run_command(command1, command2=None): def save_to_pass(event, path, text): password = text.GetLineText(0) - print(password) command1 = '/bin/echo ' + password command2 = '/usr/bin/pass insert -m ' + path result = run_command(command1, command2)