| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,7 +10,6 @@ | |||
| 10 | 10 | import subprocess | |
| 11 | 11 | import sys | |
| 12 | 12 | import time | |
| 13 | - import threading | ||
| 14 | 13 | ||
| 15 | 14 | gettext.install("mintupdate", "/usr/share/locale") | |
| 16 | 15 | ||
@@ -33,21 +32,6 @@ | |||
| 33 | 32 | ||
| 34 | 33 | CONFIG_PATH = os.path.expanduser("~/.linuxmint/mintupdate") | |
| 35 | 34 | ||
| 36 | - # Used as a decorator to run things in the background | ||
| 37 | - def _async(func): | ||
| 38 | - def wrapper(*args, **kwargs): | ||
| 39 | - thread = threading.Thread(target=func, args=args, kwargs=kwargs) | ||
| 40 | - thread.daemon = True | ||
| 41 | - thread.start() | ||
| 42 | - return thread | ||
| 43 | - return wrapper | ||
| 44 | - | ||
| 45 | - # Used as a decorator to run things in the main loop, from another thread | ||
| 46 | - def _idle(func): | ||
| 47 | - def wrapper(*args): | ||
| 48 | - GLib.idle_add(func, *args) | ||
| 49 | - return wrapper | ||
| 50 | - | ||
| 51 | 35 | def get_release_dates(): | |
| 52 | 36 | """ Get distro release dates for support duration calculation """ | |
| 53 | 37 | release_dates = {} | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,8 +25,8 @@ | |||
| 25 | 25 | from multiprocess import Process, Queue | |
| 26 | 26 | ||
| 27 | 27 | from Classes import (CONFIG_PATH, CONFIGURED_KERNEL_TYPE, KERNEL_PKG_NAMES, | |
| 28 | - PRIORITY_UPDATES, SUPPORTED_KERNEL_TYPES, Alias, KernelVersion, Update, | ||
| 29 | - _idle) | ||
| 28 | + PRIORITY_UPDATES, SUPPORTED_KERNEL_TYPES, Alias, KernelVersion, Update) | ||
| 29 | + from util import _idle | ||
| 30 | 30 | ||
| 31 | 31 | gettext.install("mintupdate", "/usr/share/locale") | |
| 32 | 32 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,7 +17,8 @@ | |||
| 17 | 17 | from apt.utils import get_maintenance_end_date | |
| 18 | 18 | ||
| 19 | 19 | from Classes import CONFIGURED_KERNEL_TYPE, KERNEL_PKG_NAMES, \ | |
| 20 | - SUPPORTED_KERNEL_TYPES, get_release_dates, _idle, _async | ||
| 20 | + SUPPORTED_KERNEL_TYPES, get_release_dates | ||
| 21 | + from util import _idle, _async | ||
| 21 | 22 | ||
| 22 | 23 | # i18n | |
| 23 | 24 | APP = 'mintupdate' | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -33,8 +33,8 @@ | |||
| 33 | 33 | from kernelwindow import KernelWindow | |
| 34 | 34 | from preferences import PreferencesWindow | |
| 35 | 35 | ||
| 36 | - from Classes import MainloopTimer, Update, PRIORITY_UPDATES, UpdateTracker, _idle, _async | ||
| 37 | - from util import on_battery | ||
| 36 | + from Classes import MainloopTimer, Update, PRIORITY_UPDATES, UpdateTracker | ||
| 37 | + from util import on_battery, _idle, _async | ||
| 38 | 38 | ||
| 39 | 39 | ||
| 40 | 40 | settings = Gio.Settings(schema_id="com.linuxmint.updates") | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,7 +10,7 @@ | |||
| 10 | 10 | ||
| 11 | 11 | gi.require_version('Gtk', '3.0') | |
| 12 | 12 | from gi.repository import Gtk, Gio | |
| 13 | - from Classes import _idle, _async | ||
| 13 | + from util import _idle, _async | ||
| 14 | 14 | gettext.install("mintupdate", "/usr/share/locale") | |
| 15 | 15 | ||
| 16 | 16 | class Assistant: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,6 +4,23 @@ | |||
| 4 | 4 | from gi.repository import Gio, GLib | |
| 5 | 5 | ||
| 6 | 6 | ||
| 7 | + # Used as a decorator to run things in the background | ||
| 8 | + def _async(func): | ||
| 9 | + def wrapper(*args, **kwargs): | ||
| 10 | + thread = threading.Thread(target=func, args=args, kwargs=kwargs) | ||
| 11 | + thread.daemon = True | ||
| 12 | + thread.start() | ||
| 13 | + return thread | ||
| 14 | + return wrapper | ||
| 15 | + | ||
| 16 | + | ||
| 17 | + # Used as a decorator to run things in the main loop, from another thread | ||
| 18 | + def _idle(func): | ||
| 19 | + def wrapper(*args): | ||
| 20 | + GLib.idle_add(func, *args) | ||
| 21 | + return wrapper | ||
| 22 | + | ||
| 23 | + | ||
| 7 | 24 | def on_battery(): | |
| 8 | 25 | # Query UPower over the system D-Bus. Works for both root (system services) | |
| 9 | 26 | # and user contexts; UPower's default policy allows property reads from any uid. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments