mirror of
https://github.com/Snigdha-OS/snigdhaos-blackbox.git
synced 2025-09-21 12:05:02 +02:00
update master branch
This commit is contained in:
@@ -23,9 +23,10 @@ from ui.PackagesImportDialog import PackagesImportDialog
|
||||
|
||||
import gi
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk,Gdk,GdkPixbuf, Pango
|
||||
from gi.repository import Gtk,Gdk,GdkPixbuf, Pango, GLib
|
||||
|
||||
import Functions as fn
|
||||
from Settings import Settings
|
||||
|
||||
base_dir = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
@@ -137,5 +138,74 @@ class Main(Gtk.Window): # Basic OOPS Concept
|
||||
)
|
||||
fn.get_current_installed()
|
||||
installed_lst_file = "%s/cache/installed.lst" % base_dir
|
||||
|
||||
packages_app_start_file = "%s/%s-packages.txt" % (
|
||||
fn.log_dir,
|
||||
fn.datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
|
||||
)
|
||||
if os.path.exists(installed_lst_file):
|
||||
fn.logger.info(
|
||||
"Created installed.lst"
|
||||
)
|
||||
thread_pacman_sync_db = fn.threading.Thread(
|
||||
name="thread_pacman_sync_db",
|
||||
target=self.pacman_db_sync,
|
||||
daemon=True,
|
||||
)
|
||||
thread_pacman_sync_db.start()
|
||||
except Exception as e:
|
||||
fn.logger.error(
|
||||
"Found Exception in Main(): %s" % e
|
||||
)
|
||||
|
||||
def pacman_db_sync(self):
|
||||
sync_err = fn.sync_package_db()
|
||||
if sync_err is not None:
|
||||
fn.logger.error(
|
||||
"Pacman Database Synchronization Faild!"
|
||||
)
|
||||
print("--")
|
||||
GLib.idle_add(
|
||||
self.show_sync_db_message_dialog,
|
||||
sync_err,
|
||||
priority=GLib.PRIORITY_DEFAULT,
|
||||
)
|
||||
else:
|
||||
fn.logger.info(
|
||||
"Pacman Dtabase Synchronization Completed."
|
||||
)
|
||||
return True
|
||||
|
||||
def show_sync_db_message_dialog(self, sync_err):
|
||||
message_dialog = MessageDialog(
|
||||
"Error",
|
||||
"Pacman db Synchronization faled!",
|
||||
"Failed to run command: sudo pacman -Sy\nPacman db synchronization failed.\nCheck pcman sync log",
|
||||
sync_err,
|
||||
"error",
|
||||
True,
|
||||
)
|
||||
message_dialog.show_all()
|
||||
message_dialog.run()
|
||||
message_dialog.hide()
|
||||
|
||||
def on_keypress_event(self, widget, event):
|
||||
shortcut = Gtk.accelerator_get_label(event.keyval, event.state)
|
||||
if shortcut in ("Ctrl+F", "Ctrl+Mod2+F"):
|
||||
self.searchentry.grab_focus()
|
||||
if shortcut in ("Ctrl+I", "Ctrl+Mod2+I"):
|
||||
fn.show_package_info(self)
|
||||
|
||||
def on_search_activated(self, searchentry):
|
||||
if searchentry.get_text_length() == 0 and self.search_activated:
|
||||
GUI.setup_gui(
|
||||
self,
|
||||
Gtk,
|
||||
Gdk,
|
||||
GdkPixbuf,
|
||||
base_dir,
|
||||
os,
|
||||
Pango,
|
||||
None,
|
||||
)
|
||||
self.search_activated = False
|
||||
|
||||
|
Reference in New Issue
Block a user