Test code

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

@ -104,101 +104,101 @@
{ {
"name" : "Calculator", "name" : "Calculator",
"icon" : "org.gnome.Calculator", "icon" : "org.gnome.Calculator",
"flatpak-id" : "org.gnome.Calculator", "flatpak" : true,
"snap-id" : "gnome-calculator" "snap" : true
}, },
{ {
"name" : "Calendar", "name" : "Calendar",
"icon" : "org.gnome.Calendar", "icon" : "org.gnome.Calendar",
"flatpak-id" : "org.gnome.Calendar" "flatpak" : true
}, },
{ {
"name" : "Characters", "name" : "Characters",
"icon" : "org.gnome.Characters", "icon" : "org.gnome.Characters",
"flatpak-id" : "org.gnome.Characters", "flatpak" : true,
"snap-id" : "gnome-characters" "snap" : true
}, },
{ {
"name" : "Cheese", "name" : "Cheese",
"icon" : "org.gnome.Cheese", "icon" : "org.gnome.Cheese",
"flatpak-id" : "org.gnome.Cheese", "flatpak" : true,
"snap-id" : "cheese" "snap" : true
}, },
{ {
"name" : "Clocks", "name" : "Clocks",
"icon" : "org.gnome.clocks", "icon" : "org.gnome.clocks",
"flatpak-id" : "org.gnome.clocks", "flatpak" : true,
"snap-id" : "gnome-clocks" "snap" : true
}, },
{ {
"name" : "Contacts", "name" : "Contacts",
"icon" : "org.gnome.Contacts", "icon" : "org.gnome.Contacts",
"flatpak-id" : "org.gnome.Contacts", "flatpak" : true,
"snap-id" : "gnome-contacts" "snap" : true
}, },
{ {
"name" : "Disk Usage Analyzer", "name" : "Disk Usage Analyzer",
"icon" : "org.gnome.baobab", "icon" : "org.gnome.baobab",
"flatpak-id" : "org.gnome.baobab" "flatpak" : true
}, },
{ {
"name" : "Document Viewer", "name" : "Document Viewer",
"icon" : "org.gnome.Evince", "icon" : "org.gnome.Evince",
"flatpak-id" : "org.gnome.Evince", "flatpak" : true,
"snap-id" : "evince" "snap" : true
}, },
{ {
"name" : "Extensions", "name" : "Extensions",
"icon" : "org.gnome.Extensions", "icon" : "org.gnome.Extensions",
"flatpak-id" : "org.gnome.Extensions" "flatpak" : true
}, },
{ {
"name" : "Fonts", "name" : "Fonts",
"icon" : "org.gnome.font-viewer", "icon" : "org.gnome.font-viewer",
"flatpak-id" : "org.gnome.font-viewer" "flatpak" : true
}, },
{ {
"name" : "Image Viewer", "name" : "Image Viewer",
"icon" : "org.gnome.eog", "icon" : "org.gnome.eog",
"flatpak-id" : "org.gnome.eog", "flatpak" : true,
"snap-id" : "eog" "snap" : true
}, },
{ {
"name" : "Logs", "name" : "Logs",
"icon" : "org.gnome.Logs", "icon" : "org.gnome.Logs",
"flatpak-id" : "org.gnome.Logs", "flatpak" : "org.gnome.Logs",
"snap-id" : "gnome-logs" "snap" : true
}, },
{ {
"name" : "Maps", "name" : "Maps",
"icon" : "org.gnome.Maps", "icon" : "org.gnome.Maps",
"flatpak-id" : "org.gnome.Maps" "flatpak" : true
}, },
{ {
"name" : "Music", "name" : "Music",
"icon" : "org.gnome.Music", "icon" : "org.gnome.Music",
"flatpak-id" : "org.gnome.Music" "flatpak" : true
}, },
{ {
"name" : "Photos", "name" : "Photos",
"icon" : "org.gnome.Photos", "icon" : "org.gnome.Photos",
"flatpak-id" : "org.gnome.Photos" "flatpak" : true
}, },
{ {
"name" : "Text Editor", "name" : "Text Editor",
"icon" : "org.gnome.TextEditor", "icon" : "org.gnome.TextEditor",
"flatpak-id" : "org.gnome.TextEditor" "flatpak" : true
}, },
{ {
"name" : "Videos", "name" : "Videos",
"icon" : "org.gnome.Totem", "icon" : "org.gnome.Totem",
"flatpak-id" : "org.gnome.Totem" "flatpak" : true
}, },
{ {
"name" : "Weather", "name" : "Weather",
"icon" : "org.gnome.Weather", "icon" : "org.gnome.Weather",
"flatpak-id" : "org.gnome.Weather", "flatpak" : true,
"snap-id" : "gnome-weather" "snap" : true
} }
] ]
}, },
@ -211,21 +211,101 @@
{ {
"name" : "Bottles", "name" : "Bottles",
"icon" : "com.usebottles.bottles", "icon" : "com.usebottles.bottles",
"flatpak-id" : "com.usebottles.bottles" "flatpak" : "com.usebottles.bottles"
} }
] ]
} }
], ],
"final": [ "final": [
{ {
"if": "essential-apps", "if" : "Calculator",
"type" : "command", "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", "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"]) self.status_page.set_description(self.__step["description"])
selection_dialogs = [] 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() 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() dialog.hide()
for item in self.__step["bundles"]: for item in self.__step["bundles"]:
@ -103,19 +140,9 @@ class VanillaLayoutApplications(Adw.Bin):
_customize.add_css_class("flat") _customize.add_css_class("flat")
_action_row.add_suffix(_customize) _action_row.add_suffix(_customize)
_customize.connect("clicked", present_customize, selection_dialogs[-1]) _customize.connect("clicked", present_customize, selection_dialogs[-1], _apps_list, item)
_cancel_button.connect("clicked", close_customize, selection_dialogs[-1]) _cancel_button.connect("clicked", close_customize, selection_dialogs[-1], _apps_list, item)
_apply_button.connect("clicked", apply_preferences, selection_dialogs[-1], _apps_list, item)
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)
self.bundles_list.add(_action_row) self.bundles_list.add(_action_row)
@ -129,6 +156,11 @@ class VanillaLayoutApplications(Adw.Bin):
finals = {"vars": {}, "funcs": [x for x in self.__step["final"]]} finals = {"vars": {}, "funcs": [x for x in self.__step["final"]]}
for _id, switcher in self.__register_widgets: 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 return finals
Loading…
Cancel
Save