Test code

main
kra-mo 2 years ago
parent 6e7f7e999b
commit df68244120

@ -104,101 +104,101 @@
{
"name" : "Calculator",
"icon" : "org.gnome.Calculator",
"flatpak-id" : "org.gnome.Calculator",
"snap-id" : "gnome-calculator"
"flatpak" : true,
"snap" : true
},
{
"name" : "Calendar",
"icon" : "org.gnome.Calendar",
"flatpak-id" : "org.gnome.Calendar"
"flatpak" : true
},
{
"name" : "Characters",
"icon" : "org.gnome.Characters",
"flatpak-id" : "org.gnome.Characters",
"snap-id" : "gnome-characters"
"flatpak" : true,
"snap" : true
},
{
"name" : "Cheese",
"icon" : "org.gnome.Cheese",
"flatpak-id" : "org.gnome.Cheese",
"snap-id" : "cheese"
"flatpak" : true,
"snap" : true
},
{
"name" : "Clocks",
"icon" : "org.gnome.clocks",
"flatpak-id" : "org.gnome.clocks",
"snap-id" : "gnome-clocks"
"flatpak" : true,
"snap" : true
},
{
"name" : "Contacts",
"icon" : "org.gnome.Contacts",
"flatpak-id" : "org.gnome.Contacts",
"snap-id" : "gnome-contacts"
"flatpak" : true,
"snap" : true
},
{
"name" : "Disk Usage Analyzer",
"icon" : "org.gnome.baobab",
"flatpak-id" : "org.gnome.baobab"
"flatpak" : true
},
{
"name" : "Document Viewer",
"icon" : "org.gnome.Evince",
"flatpak-id" : "org.gnome.Evince",
"snap-id" : "evince"
"flatpak" : true,
"snap" : true
},
{
"name" : "Extensions",
"icon" : "org.gnome.Extensions",
"flatpak-id" : "org.gnome.Extensions"
"flatpak" : true
},
{
"name" : "Fonts",
"icon" : "org.gnome.font-viewer",
"flatpak-id" : "org.gnome.font-viewer"
"flatpak" : true
},
{
"name" : "Image Viewer",
"icon" : "org.gnome.eog",
"flatpak-id" : "org.gnome.eog",
"snap-id" : "eog"
"flatpak" : true,
"snap" : true
},
{
"name" : "Logs",
"icon" : "org.gnome.Logs",
"flatpak-id" : "org.gnome.Logs",
"snap-id" : "gnome-logs"
"flatpak" : "org.gnome.Logs",
"snap" : true
},
{
"name" : "Maps",
"icon" : "org.gnome.Maps",
"flatpak-id" : "org.gnome.Maps"
"flatpak" : true
},
{
"name" : "Music",
"icon" : "org.gnome.Music",
"flatpak-id" : "org.gnome.Music"
"flatpak" : true
},
{
"name" : "Photos",
"icon" : "org.gnome.Photos",
"flatpak-id" : "org.gnome.Photos"
"flatpak" : true
},
{
"name" : "Text Editor",
"icon" : "org.gnome.TextEditor",
"flatpak-id" : "org.gnome.TextEditor"
"flatpak" : true
},
{
"name" : "Videos",
"icon" : "org.gnome.Totem",
"flatpak-id" : "org.gnome.Totem"
"flatpak" : true
},
{
"name" : "Weather",
"icon" : "org.gnome.Weather",
"flatpak-id" : "org.gnome.Weather",
"snap-id" : "gnome-weather"
"flatpak" : true,
"snap" : true
}
]
},
@ -211,21 +211,101 @@
{
"name" : "Bottles",
"icon" : "com.usebottles.bottles",
"flatpak-id" : "com.usebottles.bottles"
"flatpak" : "com.usebottles.bottles"
}
]
}
],
"final": [
{
"if": "essential-apps",
"if" : "Calculator",
"type" : "command",
"commands": ["flatpak install org.gnome.Geary || snap install snapd"]
"commands" : "flatpak install org.gnome.Calculator || snap install gnome-calculator"
},
{
"if": "utilities",
"if" : "Calendar",
"type" : "command",
"commands": ["flatpak install org.gnome.Geary || snap install snapd"]
"commands" : "flatpak install org.gnome.Calendar"
},
{
"if" : "Characters",
"type" : "command",
"commands" : "flatpak install org.gnome.Characters || snap install gnome-characters"
},
{
"if" : "Cheese",
"type" : "command",
"commands" : "flatpak install org.gnome.Cheese || snap install cheese"
},
{
"if" : "Clocks",
"type" : "command",
"commands" : "flatpak install org.gnome.clocks || snap install gnome-clocks"
},
{
"if" : "Contacts",
"type" : "command",
"commands" : "flatpak install org.gnome.Contacts || snap install gnome-contacts"
},
{
"if" : "Disk Usage Alanyzer",
"type" : "command",
"commands" : "flatpak install org.gnome.baobab"
},
{
"if" : "Evince",
"type" : "command",
"commands" : "flatpak install org.gnome.Evince || snap install evince"
},
{
"if" : "Extensions",
"type" : "command",
"commands" : "flatpak install org.gnome.Extensions"
},
{
"if" : "Fonts",
"type" : "command",
"commands" : "flatpak install org.gnome.Fonts"
},
{
"if" : "Image Viewer",
"type" : "command",
"commands" : "flatpak install org.gnome.eog || snap install eog"
},
{
"if" : "Logs",
"type" : "command",
"commands" : "flatpak install org.gnome.Logs || snap install gnome-logs"
},
{
"if" : "Maps",
"type" : "command",
"commands" : "flatpak install org.gnome.Maps"
},
{
"if" : "Music",
"type" : "command",
"commands" : "flatpak install org.gnome.Music"
},
{
"name" : "Photos",
"icon" : "org.gnome.Photos",
"flatpak" : "org.gnome.Photos"
},
{
"if" : "Text Editor",
"type" : "command",
"commands" : "flatpak install org.gnome.TextEditor"
},
{
"if" : "Videos",
"type" : "command",
"commands" : "flatpak install org.gnome.Totem"
},
{
"if" : "Weather",
"type" : "command",
"commands" : "flatpak install org.gnome.Weather || snap install gnome-weather"
}
]
},

@ -49,11 +49,48 @@ class VanillaLayoutApplications(Adw.Bin):
self.status_page.set_description(self.__step["description"])
selection_dialogs = []
def present_customize(widget, dialog):
def present_customize(widget, dialog, apps_list, item):
for app in item["applications"]:
try:
apps_list.remove(app["apps_action_row"])
except KeyError:
pass
if self.__window.builder.get_temp_finals("packages")["vars"]["flatpak"] == True:
package_manager = "flatpak"
elif self.__window.builder.get_temp_finals("packages")["vars"]["snap"] == True:
try:
package_manager = "snap"
except KeyError:
continue
else:
continue
try:
if app[package_manager]:
_apps_action_row = Adw.ActionRow(
title=app["name"],
icon_name=app["icon"]
)
_app_switcher = Gtk.Switch()
_app_switcher.set_active(True)
_app_switcher.set_valign(Gtk.Align.CENTER)
_apps_action_row.add_suffix(_app_switcher)
apps_list.add(_apps_action_row)
app["apps_action_row"] = _apps_action_row
app["switch"] = _app_switcher
try:
app["switch"].set_active(app["active"])
except KeyError:
pass
except KeyError:
continue
dialog.show()
print(self.__window.builder.get_temp_finals("packages"))
def close_customize(widget, dialog):
def close_customize(widget, dialog, apps_list, item):
dialog.hide()
def apply_preferences(widget, dialog, apps_list, item):
for app in item["applications"]:
app["active"] = app["switch"].get_active()
dialog.hide()
for item in self.__step["bundles"]:
@ -103,19 +140,9 @@ class VanillaLayoutApplications(Adw.Bin):
_customize.add_css_class("flat")
_action_row.add_suffix(_customize)
_customize.connect("clicked", present_customize, selection_dialogs[-1])
_cancel_button.connect("clicked", close_customize, selection_dialogs[-1])
for app in item["applications"]:
_apps_action_row = Adw.ActionRow(
title=app["name"],
icon_name=app["icon"]
)
_app_switcher = Gtk.Switch()
_app_switcher.set_active(True)
_app_switcher.set_valign(Gtk.Align.CENTER)
_apps_action_row.add_suffix(_app_switcher)
_apps_list.add(_apps_action_row)
_customize.connect("clicked", present_customize, selection_dialogs[-1], _apps_list, item)
_cancel_button.connect("clicked", close_customize, selection_dialogs[-1], _apps_list, item)
_apply_button.connect("clicked", apply_preferences, selection_dialogs[-1], _apps_list, item)
self.bundles_list.add(_action_row)
@ -129,6 +156,11 @@ class VanillaLayoutApplications(Adw.Bin):
finals = {"vars": {}, "funcs": [x for x in self.__step["final"]]}
for _id, switcher in self.__register_widgets:
finals["vars"][_id] = switcher.get_active()
if switcher.get_active() == True:
for app in _id["applications"]:
finals["vars"][app] = app["active"]
else:
for app in _id["applications"]:
finals["vars"][app] = False
return finals
Loading…
Cancel
Save