Skip to content

Commit

Permalink
Merge branch 'master' into unmount-fail
Browse files Browse the repository at this point in the history
  • Loading branch information
samuel-w committed Dec 13, 2020
2 parents 509bdec + 19b4946 commit 8d7a256
Show file tree
Hide file tree
Showing 36 changed files with 677 additions and 224 deletions.
4 changes: 4 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[run]
omit = tests/*
source=vorta
relative_files=true
10 changes: 9 additions & 1 deletion .github/stale.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 60

# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7

# Issues with these labels will never be considered stale
exemptLabels:
- "status:idea"
Expand All @@ -14,12 +16,18 @@ exemptLabels:
- "type:feature"
- "type:refactor"
- "type:task"

# Label to use when marking an issue as stale
staleLabel: "status:stale"

# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
closeComment: false

# Limit to only `issues` or `pulls`
only: issues
18 changes: 14 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ jobs:
fail-fast: false

matrix:
python-version: [3.6, 3.7, 3.8]
python-version: [3.6, 3.7, 3.8, 3.9]
os: [ubuntu-latest, macos-latest]
exclude:
# Only test Python 3.7 on macOS
- os: macos-latest
python-version: 3.6
- os: macos-latest
python-version: 3.8
- os: macos-latest
python-version: 3.9

steps:
- uses: actions/checkout@v2
Expand All @@ -39,6 +41,7 @@ jobs:
- name: Install Vorta
run: |
pip install .
pip install coverage
pip install borgbackup
pip install -r requirements.d/dev.txt
# - name: Setup tmate session
Expand All @@ -53,12 +56,19 @@ jobs:
export $(dbus-launch)
(herbstluftwm) &
sleep 3
pytest
coverage run -m pytest
- name: Test with pytest (macOS)
if: runner.os == 'macOS'
run: |
pytest
coverage run -m pytest
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
env:
OS: ${{ runner.os }}
python: ${{ matrix.python-version }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
env_vars: OS, python
lint:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ translations-to-qm: ## Compile .ts text files to binary .qm files.
flatpak-install: translations-to-qm
pip3 install --prefix=/app --no-deps .
install -D ${FLATPAK_XML} /app/share/metainfo/com.borgbase.Vorta.appdata.xml
install -D package/icon.svg /app/share/icons/hicolor/scalable/apps/com.borgbase.Vorta.svg
install -D src/vorta/assets/icons/icon.svg /app/share/icons/hicolor/scalable/apps/com.borgbase.Vorta.svg
install -D package/icon-symbolic.svg /app/share/icons/hicolor/symbolic/apps/com.borgbase.Vorta-symbolic.svg
install -D src/vorta/assets/metadata/com.borgbase.Vorta.desktop /app/share/applications/com.borgbase.Vorta.desktop

Expand Down
3 changes: 2 additions & 1 deletion flatpak/com.borgbase.Vorta.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"--talk-name=org.freedesktop.DBus.*",
"--talk-name=org.freedesktop.Flatpak.*",
"--talk-name=org.freedesktop.secrets",
"--talk-name=org.kde.kwalletd5",
"--socket=ssh-auth",
"--talk-name=org.freedesktop.Notifications",
"--system-talk-name=org.freedesktop.NetworkManager"
Expand Down Expand Up @@ -57,4 +58,4 @@
]
}
]
}
}
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ extension-pkg-whitelist=PyQt5
load-plugins=

[pylint.messages control]
disable= W0511,C0301,R0903,R0201,W0212,C0114,C0115,C0116,C0103,E0611,E1120,C0415,R0914,R0912,R0915
disable= W0503,W0511,C0301,R0903,R0201,W0212,C0114,C0115,C0116,C0103,E0611,E1120,C0415,R0914,R0912,R0915

[pylint.format]
max-line-length=120
2 changes: 1 addition & 1 deletion src/vorta/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def main():
app = VortaApp(sys.argv, single_app=True)
app.updater = get_updater()

sys.exit(app.exec_())
sys.exit(app.exec())


if __name__ == '__main__':
Expand Down
20 changes: 8 additions & 12 deletions src/vorta/application.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
import sys
import sip
from PyQt5 import QtCore
from PyQt5.QtWidgets import QMessageBox

Expand Down Expand Up @@ -47,8 +46,9 @@ def __init__(self, args_raw, single_app=False):
self.scheduler = VortaScheduler(self)
self.setApplicationName("Vorta")

# Prepare system tray icon
# Prepare tray and main window
self.tray = TrayMenu(self)
self.main_window = MainWindow(self)

args = parse_args()
if getattr(args, 'daemonize', False):
Expand Down Expand Up @@ -88,15 +88,12 @@ def create_backup_action(self, profile_id=None):
self.backup_progress_event.emit(translate('messages', msg['message']))

def open_main_window_action(self):
self.main_window = MainWindow(self)
self.main_window.show()
self.main_window.raise_()

def _main_window_exists(self):
return hasattr(self, 'main_window') and not sip.isdeleted(self.main_window)
self.main_window.activateWindow()

def toggle_main_window_visibility(self):
if self._main_window_exists():
if self.main_window.isVisible():
self.main_window.close()
else:
self.open_main_window_action()
Expand Down Expand Up @@ -125,14 +122,13 @@ def set_borg_details_action(self):

def set_borg_details_result(self, result):
"""
Receive result from BorgVersionThread. If MainWindow is open, set the version in misc tab.
Receive result from BorgVersionThread.
If no valid version was found, display an error.
"""
if 'version' in result['data']:
borg_compat.set_version(result['data']['version'], result['data']['path'])
if self._main_window_exists():
self.main_window.miscTab.set_borg_details(borg_compat.version, borg_compat.path)
self.main_window.repoTab.toggle_available_compression()
self.main_window.miscTab.set_borg_details(borg_compat.version, borg_compat.path)
self.main_window.repoTab.toggle_available_compression()
else:
self._alert_missing_borg()

Expand All @@ -142,4 +138,4 @@ def _alert_missing_borg(self):
msg.setText(self.tr("No Borg Binary Found"))
msg.setInformativeText(self.tr("Vorta was unable to locate a usable Borg Backup binary."))
msg.setStandardButtons(QMessageBox.Ok)
msg.exec_()
msg.exec()
73 changes: 67 additions & 6 deletions src/vorta/assets/UI/sourcetab.ui
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
<item>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0">
<item>
<widget class="QListWidget" name="sourceFilesWidget">
<widget class="QTableWidget" name="sourceFilesWidget">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
Expand All @@ -37,12 +40,50 @@
<height>0</height>
</size>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
<property name="sortingEnabled">
<bool>true</bool>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<property name="showGrid">
<bool>false</bool>
</property>
<attribute name="horizontalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderHighlightSections">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderHighlightSections">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string>Path</string>
</property>
</column>
<column>
<property name="text">
<string>Type</string>
</property>
</column>
<column>
<property name="text">
<string>Size</string>
</property>
</column>
<column>
<property name="text">
<string>File Count</string>
</property>
</column>
</widget>
</item>
<item>
Expand All @@ -61,6 +102,13 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="sourceRemove">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="paste">
<property name="toolTip">
Expand All @@ -71,13 +119,26 @@
</property>
</widget>
</item>
<item alignment="Qt::AlignTop">
<widget class="QPushButton" name="sourceRemove">
<item>
<widget class="QPushButton" name="sourcesUpdate">
<property name="text">
<string>Remove</string>
<string>Recalculate sizes</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
Expand Down
File renamed without changes
46 changes: 22 additions & 24 deletions src/vorta/autostart.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import sys
import os
from pathlib import Path

AUTOSTART_DELAY = """StartupNotify=false
X-GNOME-Autostart-enabled=true
Expand Down Expand Up @@ -33,33 +31,33 @@ def open_app_at_startup(enabled=True):
LSSharedFileListItemRemove(login_items, new_item)

elif sys.platform.startswith('linux'):
from appdirs import user_config_dir
from pathlib import Path

is_flatpak = Path('/.flatpak-info').exists()

with open(os.path.join(os.path.dirname(__file__),
"assets/metadata/com.borgbase.Vorta.desktop")) as desktop_file:
with open(Path(__file__).parent / "assets/metadata/com.borgbase.Vorta.desktop") as desktop_file:
desktop_file_text = desktop_file.read()

# Find XDG_CONFIG_HOME unless when running in flatpak
if is_flatpak:
autostart_path = Path.home() / '.config' / 'autostart'
else:
autostart_path = Path(os.environ.get(
"XDG_CONFIG_HOME", os.path.expanduser("~") + '/.config') + "/autostart")
# Find XDG_CONFIG_HOME unless when running in flatpak
if is_flatpak:
autostart_path = Path.home() / '.config' / 'autostart'
else:
autostart_path = Path(user_config_dir("autostart"))

if not autostart_path.exists():
autostart_path.mkdir()
if not autostart_path.exists():
autostart_path.mkdir()

autostart_file_path = autostart_path / 'vorta.desktop'
autostart_file_path = autostart_path / 'vorta.desktop'

if enabled:
# Replace to for flatpak if appropriate and start in background
desktop_file_text = desktop_file_text.replace(
"Exec=vorta", "Exec=flatpak run com.borgbase.Vorta --daemonize" if is_flatpak
else "Exec=vorta --daemonize")
# Add autostart delay
desktop_file_text += (AUTOSTART_DELAY)
if enabled:
# Replace command for flatpak if appropriate and start in background
desktop_file_text = desktop_file_text.replace(
"Exec=vorta", "Exec=flatpak run com.borgbase.Vorta --daemonize" if is_flatpak
else "Exec=vorta --daemonize")
# Add autostart delay
desktop_file_text += (AUTOSTART_DELAY)

autostart_file_path.write_text(desktop_file_text)
else:
if autostart_file_path.exists():
autostart_file_path.unlink()
autostart_file_path.write_text(desktop_file_text)
elif autostart_file_path.exists():
autostart_file_path.unlink()
Loading

0 comments on commit 8d7a256

Please sign in to comment.