Skip to content

Commit

Permalink
up to date ?
Browse files Browse the repository at this point in the history
  • Loading branch information
arcolinuxz committed May 11, 2023
1 parent 6f6e8ef commit 0c70f83
Show file tree
Hide file tree
Showing 3 changed files with 666 additions and 63 deletions.
82 changes: 40 additions & 42 deletions usr/share/arcolinux-app-glade/arcolinux_application_glade.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,20 @@ class Main:

def __init__(self):
# Setup intialization for logging and Gui
self.splash()
self.setup_logging()
self.back_ups()
self.versioning()
self.setup_gui()

def splash(self):
# splash screen
splScr = splash.splashScreen()
while Gtk.events_pending():
Gtk.main_iteration()
sleep(1)
splScr.destroy()

def setup_logging(self):
# defining handlers for terminal and log file
self.handlers = [
Expand Down Expand Up @@ -120,23 +129,13 @@ def versioning(self):
)

def setup_gui(self):
self.hold_alacritty = False
self.packagesp = ""
# self.packages_path =
self.timeout_id = None

# https://python-gtk-3-tutorial.readthedocs.io/en/latest/builder.html
logging.info("Building the Gui from the glade file")
self.builder = Gtk.Builder()
self.builder.add_from_file(GUI_UI_FILE)

# splash screen
splScr = splash.splashScreen()
while Gtk.events_pending():
Gtk.main_iteration()
sleep(1)
splScr.destroy()

logging.info("Connecting the glad signals")
self.builder.connect_signals(self)

Expand All @@ -159,13 +158,12 @@ def on_close_clicked(self, widget):
############################################################################

def on_iso_choices_changed(self, widget):
text = widget.get_active_text()
self.choice = text
self.choice = widget.get_active_text()
logging.info("You selected = " + self.choice)

def on_hold_toggled(self, widget):
enabled_hold = widget.get_active()
self.hold_alacritty = enabled_hold
if enabled_hold:
self.enabled_hold = widget.get_active()
if self.enabled_hold:
logging.info("--hold for Alacritty is on")
else:
logging.info("--hold for Alacritty is off")
Expand Down Expand Up @@ -253,7 +251,7 @@ def on_create_arco_clicked(self, widget):

logging.info("Launching the building script")

if self.hold_alacritty:
if self.enabled_hold:
critty = "alacritty --hold -e"
logging.info("Using the hold option")
else:
Expand Down Expand Up @@ -494,36 +492,37 @@ def on_pacman_reset_cached_clicked(self, widget):
False,
)

def on_find_path(self, widget):
dialog = Gtk.FileChooserDialog(
title="Please choose a file",
action=Gtk.FileChooserAction.OPEN,
)
filter = Gtk.FileFilter()
filter.set_name("Text files")
dialog.set_current_folder(fn.home)
dialog.add_buttons(
Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, "Open", Gtk.ResponseType.OK
)
dialog.connect("response", self.open_response_cb)

dialog.show()

def open_response_cb(self, dialog, response):
if response == Gtk.ResponseType.OK:
self.packages_path.set_text(dialog.get_filename())
self.packagesp = self.packages_path.set_text(dialog.get_filename())
dialog.destroy()
elif response == Gtk.ResponseType.CANCEL:
dialog.destroy()
# def on_find_path(self, widget):
# dialog = Gtk.FileChooserDialog(
# title="Please choose a file",
# action=Gtk.FileChooserAction.OPEN,
# )
# filter = Gtk.FileFilter()
# filter.set_name("Text files")
# dialog.set_current_folder(fn.home)
# dialog.add_buttons(
# Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, "Open", Gtk.ResponseType.OK
# )
# dialog.connect("response", self.open_response_cb)

# dialog.show()

# def open_response_cb(self, dialog, response):
# if response == Gtk.ResponseType.OK:
# self.packages_path.set_text(dialog.get_filename())
# self.packagesp = self.packages_path.set_text(dialog.get_filename())
# dialog.destroy()
# elif response == Gtk.ResponseType.CANCEL:
# dialog.destroy()

def on_pacman_install_packages(self, widget):
path = self.packagesp
if len(path) > 1 and not path == "Choose a file first":
filechooserbutton = self.builder.get_object("install_path")
path = filechooserbutton.get_filename()
if len(path) > 1:
logging.info("Installing packages from selected file")
logging.info("You selected this file")
logging.info("File: " + path)
fn.install_packages_path(self, self.packages_path.get_text())
fn.install_packages_path(self, path)
GLib.idle_add(
fn.show_in_app_notification,
self,
Expand All @@ -532,7 +531,6 @@ def on_pacman_install_packages(self, widget):
)
else:
logging.info("First select a file")
# self.packagesp("Choose a file first")


if __name__ == "__main__":
Expand Down
28 changes: 7 additions & 21 deletions usr/share/arcolinux-app-glade/gGui.ui
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@
<property name="width-request">100</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-right">364</property>
<property name="label" translatable="yes">Install packages from file:</property>
</object>
<packing>
Expand All @@ -445,21 +446,7 @@
</packing>
</child>
<child>
<object class="GtkEntry" id="packages_path">
<property name="name">packages_path</property>
<property name="width-request">165</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="width-chars">42</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="on_find_path">
<object class="GtkButton" id="on_install">
<property name="label" translatable="yes">Install</property>
<property name="width-request">100</property>
<property name="height-request">30</property>
Expand All @@ -476,17 +463,16 @@
</packing>
</child>
<child>
<object class="GtkButton" id="on_pacman_install_packages">
<property name="label" translatable="yes">...</property>
<object class="GtkFileChooserButton" id="install_path">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<signal name="clicked" handler="on_pacman_install_packages" swapped="no"/>
<property name="can-focus">False</property>
<property name="title" translatable="yes"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
<property name="pack-type">end</property>
<property name="position">4</property>
</packing>
</child>
</object>
Expand Down
Loading

0 comments on commit 0c70f83

Please sign in to comment.