FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Move _idle, _async to util module. · linuxmint/mintupdate@6fd944a · GitHub

Repository navigation

Commit 6fd944a

Browse files
committed
Move _idle, _async to util module.
1 parent cb087f7 commit 6fd944a

6 files changed

Lines changed: 24 additions & 22 deletions

File tree

‎usr/lib/linuxmint/mintUpdate/Classes.py‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import subprocess
1111
import sys
1212
import time
13-
import threading
1413

1514
gettext.install("mintupdate", "/usr/share/locale")
1615

@@ -33,21 +32,6 @@
3332

3433
CONFIG_PATH = os.path.expanduser("~/.linuxmint/mintupdate")
3534

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-
5135
def get_release_dates():
5236
""" Get distro release dates for support duration calculation """
5337
release_dates = {}

‎usr/lib/linuxmint/mintUpdate/aptUpdater.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
from multiprocess import Process, Queue
2626

2727
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
3030

3131
gettext.install("mintupdate", "/usr/share/locale")
3232

‎usr/lib/linuxmint/mintUpdate/kernelwindow.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
from apt.utils import get_maintenance_end_date
1818

1919
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
2122

2223
# i18n
2324
APP = 'mintupdate'

‎usr/lib/linuxmint/mintUpdate/mintUpdate.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
from kernelwindow import KernelWindow
3434
from preferences import PreferencesWindow
3535

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
3838

3939

4040
settings = Gio.Settings(schema_id="com.linuxmint.updates")

‎usr/lib/linuxmint/mintUpdate/rel_upgrade.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
gi.require_version('Gtk', '3.0')
1212
from gi.repository import Gtk, Gio
13-
from Classes import _idle, _async
13+
from util import _idle, _async
1414
gettext.install("mintupdate", "/usr/share/locale")
1515

1616
class Assistant:

‎usr/lib/linuxmint/mintUpdate/util.py‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,23 @@
44
from gi.repository import Gio, GLib
55

66

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+
724
def on_battery():
825
# Query UPower over the system D-Bus. Works for both root (system services)
926
# and user contexts; UPower's default policy allows property reads from any uid.

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL