Skip to content

Commit

Permalink
Merge pull request #11 from drauger-os-development/dev-branch
Browse files Browse the repository at this point in the history
Dev branch
  • Loading branch information
Batcastle authored Apr 1, 2023
2 parents 6877c31 + c267aa3 commit d8d60fd
Show file tree
Hide file tree
Showing 15 changed files with 1,065 additions and 305 deletions.
4 changes: 2 additions & 2 deletions DEBIAN/control
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Package: drauger-welcome
Version: 4.8
Version: 4.9.8
Maintainer: Thomas Castleman <contact@draugeros.org>
Section: misc
Homepage: https://github.com/drauger-os-development/drauger-welcome
Architecture: amd64
Priority: optional
Depends: python3 (>=3.5.1-3), gir1.2-gtk-3.0 (>=3.24.12-1ubuntu1), drauger-icons (>=0.0.2), bash, procps, xfconf
Depends: python3 (>=3.5.1-3), gir1.2-gtk-3.0 (>=3.24.12-1ubuntu1), drauger-icons (>=0.0.2), bash, procps, xfconf, python3-apt, python3-urllib3 (>=1.25)
Replaces: drauger-tutorial (>=1.0)
Breaks: drauger-tutorial (>=1.0)
Description: Welcome screen and tutorial All-in-One for Drauger OS
Expand Down
21 changes: 0 additions & 21 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,30 +44,9 @@ fi
if [ -d libx32 ]; then
cp -R libx32 ../"$FOLDER"/libx32
fi
if [ -d dev ]; then
cp -R dev ../"$FOLDER"/dev
fi
if [ -d home ]; then
cp -R home ../"$FOLDER"/home
fi
if [ -d proc ]; then
cp -R proc ../"$FOLDER"/proc
fi
if [ -d root ]; then
cp -R root ../"$FOLDER"/root
fi
if [ -d run ]; then
cp -R run ../"$FOLDER"/run
fi
if [ -d sbin ]; then
cp -R sbin ../"$FOLDER"/sbin
fi
if [ -d sys ]; then
cp -R sys ../"$FOLDER"/sys
fi
if [ -d tmp ]; then
cp -R tmp ../"$FOLDER"/tmp
fi
if [ -d var ]; then
cp -R var ../"$FOLDER"/var
fi
Expand Down
41 changes: 41 additions & 0 deletions etc/drauger-welcome/broadcom_driver_guide.json
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)"
]
}
12 changes: 12 additions & 0 deletions etc/drauger-welcome/nvidia_driver_guide.json
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"
}
28 changes: 28 additions & 0 deletions etc/drauger-welcome/realtek_driver_guide.json
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"
]
}
2 changes: 1 addition & 1 deletion etc/xdg/autostart/drauger-welcome.desktop
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Desktop Entry]
Name=Drauger Welcome
Version=4.6
Version=4.9
Exec=/usr/share/drauger-welcome/tut.py
Comment=Welcome Screen for Drauger OS
Type=Application
Expand Down
67 changes: 67 additions & 0 deletions usr/bin/drauger-welcome
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()
26 changes: 26 additions & 0 deletions usr/lib/python3/dist-packages/drauger_welcome/__init__.py
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 usr/lib/python3/dist-packages/drauger_welcome/alerts.py
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()
Loading

0 comments on commit d8d60fd

Please sign in to comment.