Kaydet (Commit) 323d93fb authored tarafından root's avatar root
cd /usr/lib/live-installer
GTK_THEME=Adwaita pkexec python3 main.py $*
from gi.repository import Gtk
import gi
gi.require_version('Gtk', '3.0')
class Dialog(Gtk.MessageDialog):
def __init__(self, style, buttons, title, text, text2=None, parent=None):
Gtk.MessageDialog.__init__(self, parent, 0, style, buttons)
self.set_position(Gtk.WindowPosition.CENTER)
self.set_icon_from_file("./icons/live-installer.png")
self.set_title(title)
self.set_markup(text)
self.desc = text[:30] + ' ...' if len(text) > 30 else text
if text2:
self.format_secondary_markup(text2)
if parent:
self.set_transient_for(parent)
self.set_modal(True)
def show(self):
try:
response = self.run()
if response in (Gtk.ResponseType.YES, Gtk.ResponseType.APPLY, Gtk.ResponseType.OK, Gtk.ResponseType.ACCEPT):
return True
else:
return False
finally:
self.destroy()
def MessageDialog(*args):
dialog = Dialog(Gtk.MessageType.INFO, Gtk.ButtonsType.NONE, *args)
dialog.add_button(("OK"), Gtk.ResponseType.OK)
return dialog.show()
def QuestionDialog(*args):
dialog = Dialog(Gtk.MessageType.QUESTION, Gtk.ButtonsType.NONE, *args)
dialog.add_button(("No"), Gtk.ResponseType.NO)
dialog.add_button(("Yes"), Gtk.ResponseType.YES)
return dialog.show()
def WarningDialog(*args):
dialog = Dialog(Gtk.MessageType.WARNING, Gtk.ButtonsType.NONE, *args)
dialog.add_button(("OK"), Gtk.ResponseType.OK)
return dialog.show()
def ErrorDialog(*args):
dialog = Dialog(Gtk.MessageType.ERROR, Gtk.ButtonsType.NONE, *args)
dialog.add_button(("OK"), Gtk.ResponseType.OK)
return dialog.show()
This diff is collapsed.
import os
from gi.repository import Gtk, Gdk
import gi
from frontend.gtk_interface import InstallerWindow
import sys
import subprocess
import gettext
os.environ['GTK_THEME']="Adwaita"
sys.path.insert(1, '/usr/lib/live-installer')
gi.require_version('Gtk', '3.0')
def gtk_style():
style_provider = Gtk.CssProvider()
style_provider.load_from_path('./resources/theme/gtk.css')
Gtk.StyleContext.add_provider_for_screen(
Gdk.Screen.get_default(),
style_provider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
)
# main entry
if __name__ == "__main__":
gtk_style()
if ("--expert-mode" in sys.argv):
win = InstallerWindow(expert_mode=True)
else:
win = InstallerWindow()
if ("--window" not in sys.argv):
win.fullscreen()
Gtk.main()
This diff is collapsed.
This diff is collapsed.