-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from drauger-os-development/dev-branch
Dev branch
- Loading branch information
Showing
15 changed files
with
1,065 additions
and
305 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"firmware-b43-installer": [ | ||
"1713", | ||
"4301", | ||
"4306", | ||
"4307", | ||
"4311", | ||
"4312", | ||
"4313", | ||
"4315", | ||
"4318", | ||
"4319", | ||
"4320", | ||
"4321", | ||
"4324", | ||
"4325", | ||
"4328", | ||
"4331", | ||
"4335", | ||
"4350", | ||
"4359", | ||
"4360", | ||
"4365", | ||
"43a3", | ||
"43ba", | ||
"a962" | ||
], | ||
"bcmwl-kernel-source": [ | ||
"4329", | ||
"432a", | ||
"432b", | ||
"432c", | ||
"432d", | ||
"4358", | ||
"43a0", | ||
"43b1", | ||
"4727", | ||
"4328 (rev 03)", | ||
"4365 (rev 01)" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"30": "latest", | ||
"20": "latest", | ||
"16": "latest", | ||
"10": "", | ||
"9": "", | ||
"8": "470", | ||
"7": "470", | ||
"6": "470", | ||
"5": "390", | ||
"4": "390" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"r8125-dkms": [ | ||
"r8125" | ||
], | ||
"r8168-dkms": [ | ||
"rtl8111b", | ||
"rtl8111c", | ||
"rtl8111d", | ||
"rtl8111e", | ||
"rtl8111f", | ||
"rtl8111g(s)", | ||
"rtl8111h(s)", | ||
"rtl8118(a)(s)", | ||
"rtl8119i", | ||
"rtl8111l", | ||
"rtl8168b", | ||
"rtl8168e", | ||
"rtl8168h", | ||
"rtl8111dp", | ||
"rtl8111ep", | ||
"rtl8111fp", | ||
"rtl8411", | ||
"rtl8411b", | ||
], | ||
"rtl8821ce-dkms": [ | ||
"rtl8821ce" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
# | ||
# drauger-welcome | ||
# | ||
# Copyright 2022 Thomas Castleman <contact@draugeros.org> | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
# MA 02110-1301, USA. | ||
# | ||
# | ||
"""Explain what this program does here!!!""" | ||
from __future__ import print_function | ||
import sys | ||
import drauger_welcome | ||
VERSION = "4.9.8" | ||
HELP = """ | ||
drauger-welcome, Version %s | ||
\t-h, --help print this help dialoge. | ||
\t-v, --version print current version. | ||
Pass nothing to show welcome screen. | ||
""" | ||
R = "\033[0;31m" | ||
G = "\033[0;32m" | ||
Y = "\033[1;33m" | ||
NC = "\033[0m" | ||
|
||
def eprint(args, *kwargs, color=R): | ||
"""Print to stderr easier""" | ||
print(color, file=sys.stderr, end="") | ||
print(args, file=sys.stderr, *kwargs, end="") | ||
print(NC, file=sys.stderr) | ||
|
||
|
||
if sys.version_info[0] == 2: | ||
eprint("Please run with Python 3 as Python 2 is End-of-Life.") | ||
exit(2) | ||
|
||
# get length of argv | ||
ARGC = len(sys.argv) | ||
|
||
def launch(): | ||
drauger_welcome.main_ui.welcome_show() | ||
|
||
|
||
if ARGC > 1: | ||
if (sys.argv[1] == "-v" or sys.argv[1] == "--version"): | ||
print("\n%s\n" % (VERSION)) | ||
elif (sys.argv[1] == "-h" or sys.argv[1] == "--help"): | ||
print(HELP % (VERSION)) | ||
else: | ||
eprint("Option %s not recognized." % (sys.argv[1])) | ||
eprint(HELP % (VERSION), color=NC) | ||
else: | ||
launch() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
# | ||
# __init__.py | ||
# | ||
# Copyright 2023 Thomas Castleman <contact@draugeros.org> | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
# MA 02110-1301, USA. | ||
# | ||
# | ||
"""__init__ for drauger-welcome""" | ||
from drauger_welcome import main_ui as main_ui | ||
from drauger_welcome import alerts as alerts |
122 changes: 122 additions & 0 deletions
122
usr/lib/python3/dist-packages/drauger_welcome/alerts.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
# | ||
# alerts.py | ||
# | ||
# Copyright 2023 Thomas Castleman <contact@draugeros.org> | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program; if not, write to the Free Software | ||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
# MA 02110-1301, USA. | ||
# | ||
# | ||
"""Explain what this program does here!!!""" | ||
from __future__ import print_function | ||
import sys | ||
import json | ||
import os | ||
import gi | ||
gi.require_version('Gtk', '3.0') | ||
from gi.repository import Gtk | ||
|
||
|
||
def __eprint__(*args, **kwargs): | ||
"""Make it easier for us to print to stderr""" | ||
print(*args, file=sys.stderr, **kwargs) | ||
|
||
|
||
if sys.version_info[0] == 2: | ||
__eprint__("Please run with Python 3 as Python 2 is End-of-Life.") | ||
exit(2) | ||
|
||
|
||
class Alert(Gtk.Window): | ||
"""Alert window""" | ||
def __init__(self, window_title, message, msg_type): | ||
"""Initialize Window""" | ||
Gtk.Window.__init__(self, title=window_title) | ||
self.grid = Gtk.Grid(orientation=Gtk.Orientation.VERTICAL) | ||
self.add(self.grid) | ||
self.icon = "/usr/share/icons/Drauger/scalable/menus/drauger_os-logo.svg" | ||
self.set_icon_from_file(self.icon) | ||
|
||
self.HOME = os.getenv("HOME") | ||
with open(f"{ self.HOME }/.config/drauger-welcome/no-show.json", | ||
"r") as file: | ||
self.show_settings = json.load(file) | ||
|
||
self.msg_type = msg_type | ||
|
||
self.reset(window_title, message) | ||
|
||
def reset(self, window_title, message): | ||
"""Create Window contents""" | ||
label = Gtk.Label() | ||
label.set_markup(f"<b>{ window_title }</b>") | ||
label.set_justify(Gtk.Justification.CENTER) | ||
label = self._set_default_margins(label) | ||
self.grid.attach(label, 1, 1, 8, 1) | ||
|
||
label1 = Gtk.Label() | ||
label1.set_markup(message) | ||
label1.set_justify(Gtk.Justification.CENTER) | ||
label1 = self._set_default_margins(label1) | ||
self.grid.attach(label1, 1, 2, 8, 1) | ||
|
||
start_up = Gtk.CheckButton.new_with_label("Do not show this alert again") | ||
start_up.set_active(not self.show_settings[self.msg_type]) | ||
start_up.connect("toggled", self.start_up_toggle) | ||
start_up = self._set_default_margins(start_up) | ||
self.grid.attach(start_up, 1, 3, 2, 1) | ||
|
||
button = Gtk.Button.new_with_label("Close") | ||
button.connect("clicked", self.exit) | ||
button = self._set_default_margins(button) | ||
self.grid.attach(button, 8, 3, 1, 1) | ||
|
||
def start_up_toggle(self, widget): | ||
"""Control whether to show this alert or not""" | ||
active = not widget.get_active() | ||
self.show_settings[self.msg_type] = active | ||
with open(f"{ self.HOME }/.config/drauger-welcome/no-show.json", | ||
"w") as file: | ||
json.dump(self.show_settings, file, indent=2) | ||
with open(f"{ self.HOME }/.config/drauger-welcome/no-show.json", | ||
"r") as file: | ||
self.show_settings = json.load(file) | ||
|
||
def _set_default_margins(self, widget): | ||
"""Set default margin size""" | ||
widget.set_margin_start(10) | ||
widget.set_margin_end(10) | ||
widget.set_margin_top(10) | ||
widget.set_margin_bottom(10) | ||
return widget | ||
|
||
def exit(self, button): | ||
"""Exit""" | ||
Gtk.main_quit("delete-event") | ||
self.destroy() | ||
self.data = 1 | ||
return 1 | ||
|
||
|
||
def post_alert(title, message, msg_type): | ||
window = Alert(title, message, msg_type) | ||
window.set_decorated(False) | ||
window.set_resizable(False) | ||
window.set_position(Gtk.WindowPosition.CENTER) | ||
window.connect("delete-event", Alert.exit) | ||
window.show_all() | ||
Gtk.main() |
Oops, something went wrong.