diff --git a/setup.py b/setup.py index 5707472..4d562ff 100755 --- a/setup.py +++ b/setup.py @@ -35,6 +35,7 @@ def datafilelist(installbase, sourcebase): prefix = sys.prefix lib_gbinstall = [ + 'src/confirm_installation.py', 'src/create_cfg.py', 'src/db_partition.py', 'src/end.py', @@ -67,11 +68,40 @@ slide_images = [ 'src/slide-images/ghostbsd/welcome.png' ] + +backend_query = [ + 'src/backend-query/detect-laptop.sh', + 'src/backend-query/detect-nics.sh', + 'src/backend-query/detect-sheme.sh', + 'src/backend-query/detect-vmware.sh', + 'src/backend-query/detect-wifi.sh', + 'src/backend-query/disk-info.sh', + 'src/backend-query/disk-label.sh', + 'src/backend-query/disk-list.sh', + 'src/backend-query/disk-part.sh', + 'src/backend-query/enable-net.sh', + 'src/backend-query/list-components.sh', + 'src/backend-query/list-rsync-backups.sh', + 'src/backend-query/list-tzones.sh', + 'src/backend-query/query-langs.sh', + 'src/backend-query/send-logs.sh', + 'src/backend-query/setup-ssh-keys.sh', + 'src/backend-query/sys-mem.sh', + 'src/backend-query/test-live.sh', + 'src/backend-query/test-netup.sh', + 'src/backend-query/update-part-list.sh', + 'src/backend-query/xkeyboard-layouts.sh', + 'src/backend-query/xkeyboard-models.sh', + 'src/backend-query/xkeyboard-variants.sh' + +] + # '{prefix}/share/man/man1'.format(prefix=sys.prefix), glob('data/*.1')), data_files = [ (f'{prefix}/share/applications', ['src/gbinstall.desktop']), (f'{prefix}/lib/gbinstall', lib_gbinstall), + (f'{prefix}/lib/gbinstall/backend-query', backend_query), (f'{prefix}/lib/gbinstall/slide-images/ghostbsd', slide_images) ] diff --git a/src/confirm_installation.py b/src/confirm_installation.py index e69de29..50dcd0e 100644 --- a/src/confirm_installation.py +++ b/src/confirm_installation.py @@ -0,0 +1,120 @@ +#!/usr/bin/env python +# +##################################################################### +# Copyright (c) 2009-2012, GhostBSD. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistribution's of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistribution's in binary form must reproduce the above +# copyright notice,this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# +# 3. Neither then name of GhostBSD Project nor the names of its +# contributors maybe used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +##################################################################### +# language.py show the language for the installer. + + +from gi.repository import Gtk, Gdk +import os +import os.path +import sys +from create_cfg import gbsd_cfg + +# Folder use for the installer. +tmp = "/tmp/.gbinstall/" +pcinstallcfg = f'{tmp}pcinstall.cfg' +installer = "/usr/local/lib/gbinstall/" +logo = f"{installer}logo.png" +if not os.path.exists(tmp): + os.makedirs(tmp) + +sys.path.append(installer) +cssProvider = Gtk.CssProvider() +# if os.path.exists(rcconfgbsd): +# print(True) +cssProvider.load_from_path('/usr/local/lib/gbinstall/ghostbsd-style.css') +# elif os.path.exists(rcconfdbsd): +# cssProvider.load_from_path('/usr/local/lib/gbi/desktopbsd-style.css') +screen = Gdk.Screen.get_default() +styleContext = Gtk.StyleContext() +styleContext.add_provider_for_screen(screen, cssProvider, + Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) + + +class Summary: + + def __init__(self, button3): + gbsd_cfg() + cfg_file = open(pcinstallcfg, 'r') + cfg_text = cfg_file.read() + cfg_file.close() + button3.set_sensitive(True) + # Add a Default vertical box + self.vbox1 = Gtk.VBox(False, 0) + self.vbox1.show() + # Add a second vertical box + label = Gtk.Label("Installation Summary", name="Header") + label.set_property("height-request", 40) + self.vbox1.pack_start(label, False, False, 0) + grid = Gtk.Grid() + self.vbox1.pack_start(grid, True, True, 0) + grid.set_row_spacing(10) + grid.set_column_spacing(3) + grid.set_column_homogeneous(True) + grid.set_row_homogeneous(True) + grid.set_margin_left(10) + grid.set_margin_right(10) + grid.set_margin_top(10) + grid.set_margin_bottom(10) + # Adding a Scrolling Window + scrolledwindow = Gtk.ScrolledWindow() + scrolledwindow.set_hexpand(True) + scrolledwindow.set_vexpand(True) + scrolledwindow.show() + grid.attach(scrolledwindow, 0, 1, 3, 1) + + self.textview = Gtk.TextView() + self.textbuffer = self.textview.get_buffer() + self.textbuffer.set_text(cfg_text) + scrolledwindow.add(self.textview) + + # self.wellcometext = Gtk.Label(welltext) + # self.wellcometext.set_use_markup(True) + # table = Gtk.Table() + # table.attach(self.wellcome, 0, 1, 1, 2) + # wall = Gtk.Label() + # table.attach(wall, 0, 1, 2, 3) + # table.attach(self.wellcometext, 0, 1, 3, 4) + # vhbox.pack_start(table, False, False, 5) + # image = Gtk.Image() + # image.set_from_file(logo) + # image.show() + # grid.attach(self.wellcome, 1, 1, 3, 1) + # vhbox.pack_start(image, True, True, 5) + # grid.attach(vhbox, 2, 2, 2, 9) + grid.show() + return + + def get_model(self): + return self.vbox1 diff --git a/src/create_cfg.py b/src/create_cfg.py index 9916d76..0cfd8d9 100644 --- a/src/create_cfg.py +++ b/src/create_cfg.py @@ -45,7 +45,7 @@ class gbsd_cfg(): if os.path.exists(language): langfile = open(language, 'r') lang = langfile.readlines()[0].rstrip() - f.writelines('\n# System Language\n\n') + f.writelines('\n# System Language\n') f.writelines(f'localizeLang={lang}\n') os.remove(language) # Keyboard Setting @@ -148,6 +148,7 @@ class gbsd_cfg(): root = rf[0] f.writelines('\n# Set the root pass\n') f.writelines(f'rootPass={root}\n') + os.remove(f'{tmp}root') if os.path.exists(user_passwd): # Network Configuration f.writelines('\n# Network Configuration\n') @@ -170,29 +171,10 @@ class gbsd_cfg(): f.writelines(f'defaultGroup=wheel\n') f.writelines(f'userGroups=operator\n') f.writelines('commitUser\n') + os.remove(user_passwd) f.writelines('runScript=/root/iso_to_hd.sh\n') f.writelines('runCommand=rm -f /root/iso_to_hd.sh\n') if os.path.exists(zfs_config): zfsark = """echo 'vfs.zfs.arc_max="512M"' >> /boot/loader.conf""" f.writelines(f'runCommand={zfsark}') - # adding setting for keyboard in slim - keyboard_conf = '/usr/local/etc/X11/xorg.conf.d/keyboard.conf' - k_conf_list = [ - 'Section "InputClass"', - ' Identifier "Keyboard0"', - ' Driver "kbd"', - f' Option "XkbLayout" "{kbl}"' - ] - if kbv != 'None': - k_conf_list.append(f' Option "XkbVariant" "{kbv}"') - if kbm != 'None': - k_conf_list.append(f' Option "XkbModel" "{kbm}"') - k_conf_list.append('EndSection') - for conf_line in k_conf_list: - if 'Section "InputClass"' == conf_line: - cmd = f"""echo '{conf_line}' > {keyboard_conf}""" - else: - cmd = f"""echo '{conf_line}' >> {keyboard_conf}""" - f.writelines(f'runCommand={cmd}\n') f.close() - os.remove(user_passwd) diff --git a/src/db_partition.py b/src/db_partition.py index fa0779a..7345416 100644 --- a/src/db_partition.py +++ b/src/db_partition.py @@ -42,11 +42,19 @@ pc_sysinstall = "/usr/local/sbin/pc-sysinstall" partitiondb = f"{tmp}partitiondb/" diskdb = f"{partitiondb}disk" -query_disk = f'{pc_sysinstall} disk-list' -detect_sheme = f'{pc_sysinstall} detect-sheme' -query_partition = f'{pc_sysinstall} disk-part' -query_label = f'{pc_sysinstall} disk-label' -disk_info = f'{pc_sysinstall} disk-info' +query = f'{installer}backend-query' + +query_disk = f'sh {query}/disk-list.sh' +detect_sheme = f'sh {query}/detect-sheme.sh' +query_partition = f'sh {query}/disk-part.sh' +query_label = f'sh {query}/disk-label.sh' +disk_info = f'sh {query}/disk-info.sh' + +# query_disk = f'{pc_sysinstall} disk-list' +# detect_sheme = f'{pc_sysinstall} detect-sheme' +# query_partition = f'{pc_sysinstall} disk-part' +# query_label = f'{pc_sysinstall} disk-label' +# disk_info = f'{pc_sysinstall} disk-info' memory = 'sysctl hw.physmem' disk_file = f'{tmp}disk' @@ -503,7 +511,7 @@ class autoDiskPartition(): slice_file.writelines('%s\n' % number) slice_file.close() ram = Popen(memory, shell=True, stdin=PIPE, stdout=PIPE, - universal_newlines=True, close_fds=True) + universal_newlines=True, close_fds=True) mem = ram.stdout.read() swap = int(int(mem.partition(':')[2].strip()) / (1024 * 1024)) if bios_or_uefi() == "UEFI": diff --git a/src/end.py b/src/end.py index 81618a5..82f1c97 100644 --- a/src/end.py +++ b/src/end.py @@ -51,5 +51,6 @@ class PyApp(gtk.Window): box2.pack_start(table) window.show_all() + PyApp() gtk.main() diff --git a/src/error.py b/src/error.py index eb35294..7d19e95 100644 --- a/src/error.py +++ b/src/error.py @@ -56,5 +56,6 @@ class PyApp: box2.pack_start(table) window.show_all() + PyApp() gtk.main() diff --git a/src/gbiWindow.py b/src/gbiWindow.py index 17db65c..de67740 100644 --- a/src/gbiWindow.py +++ b/src/gbiWindow.py @@ -44,6 +44,7 @@ from language import Language from installType import Types from use_ufs import use_ufs from partition import Partitions +from confirm_installation import Summary from use_zfs import ZFS from db_partition import partition_repos from install import installProgress, installSlide @@ -80,6 +81,7 @@ class MainWindow(): get_types = self.types.get_model() typebox.pack_start(get_types, True, True, 0) label = Gtk.Label("Types") + self.button1.set_sensitive(True) self.notebook.insert_page(typebox, label, 1) self.window.show_all() self.notebook.next_page() @@ -123,19 +125,16 @@ class MainWindow(): self.partition.save_selection() Rbox = Gtk.VBox(False, 0) Rbox.show() - self.rootuser = RootUser(self.button3) - get_root = self.rootuser.get_model() + self.summary = Summary(self.button3) + get_root = self.summary.get_model() Rbox.pack_start(get_root, True, True, 0) label = Gtk.Label("Root Password") + self.button3.set_label("Install") self.notebook.insert_page(Rbox, label, 3) self.window.show_all() self.notebook.next_page() - self.button3.set_sensitive(False) - self.rootuser.save_selection() - Abox = Gtk.VBox(False, 0) - Abox.show() elif page == 3: - self.adduser.save_selection() + # self.adduser.save_selection() Ibox = Gtk.VBox(False, 0) Ibox.show() install = installSlide() diff --git a/src/gbinstall.desktop b/src/gbinstall.desktop index cb064b3..02c552b 100755 --- a/src/gbinstall.desktop +++ b/src/gbinstall.desktop @@ -8,7 +8,7 @@ Icon[C]=/usr/local/lib/gbinstall/install.png Name[C]=GhostBSD Installer Categories=GNOME;GTK;System; NoDisplay=true -Exec=sudo gbi +Exec=sudo gbinstall Comment[C]=GhostBSD Installer Name=GhostBSD Installer Comment=GhostBSD Installer diff --git a/src/install.py b/src/install.py index da4723b..e2970ea 100644 --- a/src/install.py +++ b/src/install.py @@ -13,10 +13,9 @@ from gi.repository import Gtk, GLib import threading # import locale import os -from subprocess import Popen, PIPE, STDOUT, call +from subprocess import Popen, PIPE, call from time import sleep from db_partition import rDeleteParttion, destroyParttion, makingParttion -from create_cfg import gbsd_cfg from slides import gbsdSlides # from slides import dbsdSlides import sys @@ -34,13 +33,12 @@ def update_progess(probar, bartext): def read_output(command, probar): + GLib.idle_add(update_progess, probar, "Stoping hald service") call('service hald stop', shell=True) - GLib.idle_add(update_progess, probar, "Creating pcinstall.cfg") - - # If rc.conf.ghostbsd exists run gbsd_cfg - gbsd_cfg() + sleep(1) + GLib.idle_add(update_progess, probar, "Umount /media/GhostBSD") call('umount /media/GhostBSD', shell=True) - sleep(2) + sleep(1) if os.path.exists(tmp + 'delete'): GLib.idle_add(update_progess, probar, "Deleting partition") rDeleteParttion() @@ -55,10 +53,15 @@ def read_output(command, probar): GLib.idle_add(update_progess, probar, "Creating new partitions") makingParttion() sleep(1) - p = Popen(command, shell=True, stdin=PIPE, stdout=PIPE, - stderr=STDOUT, close_fds=True, universal_newlines=True) + process = Popen( + command, + shell=True, + stdout=PIPE, + close_fds=True, + universal_newlines=True + ) while True: - line = p.stdout.readline() + line = process.stdout.readline() if not line: break bartext = line.rstrip() @@ -70,11 +73,11 @@ def read_output(command, probar): print(bartext) call('service hald start', shell=True) if bartext.rstrip() == "Installation finished!": - Popen('python2.7 %send.py' % installer, shell=True, close_fds=True) + Popen(f'python3.6 {installer}end.py', shell=True, close_fds=True) call("rm -rf /tmp/.gbi/", shell=True, close_fds=True) Gtk.main_quit() else: - Popen('python2.7 %serror.py' % installer, shell=True, close_fds=True) + Popen(f'python3.6 {installer}error.py', shell=True, close_fds=True) Gtk.main_quit() @@ -103,12 +106,12 @@ class installProgress(): def __init__(self): self.pbar = Gtk.ProgressBar() self.pbar.set_show_text(True) - command = '%s -c %spcinstall.cfg' % (sysinstall, tmp) - thr = threading.Thread(target=read_output, - args=(command, self.pbar)) - thr.setDaemon(True) - thr.start() - self.pbar.show() + # command = '%s -c %spcinstall.cfg' % (sysinstall, tmp) + # thr = threading.Thread(target=read_output, + # args=(command, self.pbar)) + # thr.setDaemon(True) + # thr.start() + # self.pbar.show() def getProgressBar(self): return self.pbar diff --git a/src/installType.py b/src/installType.py index 3bbe3ea..689110b 100644 --- a/src/installType.py +++ b/src/installType.py @@ -10,7 +10,7 @@ import gi gi.require_version('Gtk', '3.0') -from gi.repository import Gtk +from gi.repository import Gtk, Gdk import os import os.path @@ -25,6 +25,17 @@ disk_file = '%sdisk' % tmp boot_file = '%sboot' % tmp signal = '%ssignal' % tmp +cssProvider = Gtk.CssProvider() +# if os.path.exists(rcconfgbsd): +# print(True) +cssProvider.load_from_path('/usr/local/lib/gbinstall/ghostbsd-style.css') +# elif os.path.exists(rcconfdbsd): +# cssProvider.load_from_path('/usr/local/lib/gbi/desktopbsd-style.css') +screen = Gdk.Screen.get_default() +styleContext = Gtk.StyleContext() +styleContext.add_provider_for_screen(screen, cssProvider, + Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) + class Types(): @@ -54,7 +65,7 @@ class Types(): return self.ne def get_model(self): - return self.box1 + return self.vbox1 def boot_manager(self, radiobutton, val): self.boot = val @@ -63,20 +74,14 @@ class Types(): boot.close() def __init__(self): - self.box1 = Gtk.VBox(False, 0) - self.box1.show() - box2 = Gtk.VBox(False, 10) - # box2.set_border_width(10) - self.box1.pack_start(box2, False, False, 0) - box2.show() - # auto partition or Customize Disk Partition. + self.vbox1 = Gtk.VBox(False, 0) + self.vbox1.show() + label = Gtk.Label("Installation Type And Boot Manager", name="Header") + label.set_property("height-request", 40) + self.vbox1.pack_start(label, False, False, 0) bbox = Gtk.VBox() - label = Gtk.Label('Installation Type And Boot Manager') - label.set_use_markup(True) - box2.pack_start(label, False, False, 10) - # create a Hbox to center the radio button. hbox = Gtk.HBox() - box2.pack_start(hbox, False, False, 10) + self.vbox1.pack_start(hbox, False, False, 10) full_ufs = Gtk.RadioButton.new_with_label_from_widget(None, "UFS Full Disk Configuration") bbox.pack_start(full_ufs, False, True, 10) full_ufs.connect("toggled", self.fstype, "ufs") @@ -98,7 +103,7 @@ class Types(): # Boot option. box3 = Gtk.VBox(False, 0) box3.set_border_width(10) - self.box1.pack_start(box3, False, False, 0) + self.vbox1.pack_start(box3, False, False, 0) box3.show() label = Gtk.Label('Boot Manager Option') label.set_use_markup(True) @@ -130,5 +135,5 @@ class Types(): boot.close() self.box3 = Gtk.VBox(False, 0) self.box3.set_border_width(0) - self.box1.pack_start(self.box3, True, True, 0) + self.vbox1.pack_start(self.box3, True, True, 0) return diff --git a/src/language.py b/src/language.py index 0b1f750..c61303f 100644 --- a/src/language.py +++ b/src/language.py @@ -35,7 +35,7 @@ # language.py show the language for the installer. -from gi.repository import Gtk +from gi.repository import Gtk, Gdk import os import os.path from sys_handler import language_dictionary @@ -52,6 +52,18 @@ title = "Welcome To GhostBSD!" welltext = """Select the language you want to use with GhostBSD.""" +cssProvider = Gtk.CssProvider() +# if os.path.exists(rcconfgbsd): +# print(True) +cssProvider.load_from_path('/usr/local/lib/gbinstall/ghostbsd-style.css') +# elif os.path.exists(rcconfdbsd): +# cssProvider.load_from_path('/usr/local/lib/gbi/desktopbsd-style.css') +screen = Gdk.Screen.get_default() +styleContext = Gtk.StyleContext() +styleContext.add_provider_for_screen(screen, cssProvider, + Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) + + class Language: # On selection it overwrite the delfaut language file. @@ -84,7 +96,9 @@ class Language: # Add a Default vertical box self.vbox1 = Gtk.VBox(False, 0) self.vbox1.show() - # Add a second vertical box + label = Gtk.Label("Welcome To GhostBSD!", name="Header") + label.set_property("height-request", 40) + self.vbox1.pack_start(label, False, False, 0) grid = Gtk.Grid() self.vbox1.pack_start(grid, True, True, 0) grid.set_row_spacing(10) @@ -130,7 +144,7 @@ class Language: image = Gtk.Image() image.set_from_file(logo) image.show() - grid.attach(self.wellcome, 1, 1, 3, 1) + # grid.attach(self.wellcome, 1, 1, 3, 1) vhbox.pack_start(image, True, True, 5) grid.attach(vhbox, 2, 2, 2, 9) grid.show() diff --git a/src/partition.py b/src/partition.py index 28ed342..5680373 100644 --- a/src/partition.py +++ b/src/partition.py @@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE. # auto_partition.py create and delete partition slice for GhostBSD installer import gi gi.require_version('Gtk', '3.0') -from gi.repository import Gtk, GObject +from gi.repository import Gtk, Gdk import os import shutil from db_partition import partition_repos, disk_query, Delete_partition @@ -70,6 +70,18 @@ boot_file = "%sboot" % tmp ufs_Partiton_list = [] +cssProvider = Gtk.CssProvider() +# if os.path.exists(rcconfgbsd): +# print(True) +cssProvider.load_from_path('/usr/local/lib/gbinstall/ghostbsd-style.css') +# elif os.path.exists(rcconfdbsd): +# cssProvider.load_from_path('/usr/local/lib/gbi/desktopbsd-style.css') +screen = Gdk.Screen.get_default() +styleContext = Gtk.StyleContext() +styleContext.add_provider_for_screen(screen, cssProvider, + Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) + + class Partitions(): def on_fs(self, widget): @@ -576,19 +588,17 @@ class Partitions(): def __init__(self, button3): self.button3 = button3 - self.box1 = Gtk.VBox(False, 0) - self.box1.show() - box2 = Gtk.VBox(False, 10) - box2.set_border_width(0) - self.box1.pack_start(box2, True, True, 0) - box2.show() + self.vbox1 = Gtk.VBox(False, 0) + self.vbox1.show() # Title - Title = Gtk.Label("Partition Editor ") - Title.set_use_markup(True) - box2.pack_start(Title, False, False, 20) + label = Gtk.Label("UFS Partition Editor", name="Header") + label.set_property("height-request", 40) + self.vbox1.pack_start(label, False, False, 0) + # Choosing disk to Select Create or delete partition. label = Gtk.Label("Select a drive:") label.set_use_markup(True) + sw = Gtk.ScrolledWindow(hexpand=True, vexpand=True) sw.set_shadow_type(Gtk.ShadowType.ETCHED_IN) sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) @@ -637,10 +647,16 @@ class Partitions(): self.tree_selection.connect("changed", self.partition_selection) sw.add(self.treeview) sw.show() - box2.pack_start(sw, True, True, 0) - box2 = Gtk.HBox(False, 10) + + box2 = Gtk.VBox(False, 10) box2.set_border_width(10) - self.box1.pack_start(box2, False, False, 10) + self.vbox1.pack_start(box2, True, True, 0) + box2.show() + box2.pack_start(sw, True, True, 0) + + box2 = Gtk.HBox(False, 10) + box2.set_border_width(0) + self.vbox1.pack_start(box2, False, False, 0) box2.show() self.scheme = 'GPT' box2.pack_start(self.delete_create_button(), @@ -671,4 +687,4 @@ class Partitions(): def get_model(self): self.tree_selection.select_path(0) - return self.box1 + return self.vbox1 diff --git a/src/use_ufs.py b/src/use_ufs.py index 9f14d3a..8c86d87 100644 --- a/src/use_ufs.py +++ b/src/use_ufs.py @@ -28,7 +28,7 @@ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """ -from gi.repository import Gtk +from gi.repository import Gtk, Gdk import os import os.path import re @@ -50,6 +50,17 @@ boot_file = '%sboot' % tmp ufs_dsk_list = [] +cssProvider = Gtk.CssProvider() +# if os.path.exists(rcconfgbsd): +# print(True) +cssProvider.load_from_path('/usr/local/lib/gbinstall/ghostbsd-style.css') +# elif os.path.exists(rcconfdbsd): +# cssProvider.load_from_path('/usr/local/lib/gbi/desktopbsd-style.css') +screen = Gdk.Screen.get_default() +styleContext = Gtk.StyleContext() +styleContext.add_provider_for_screen(screen, cssProvider, + Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) + # Find if pasword contain only lower case and number def lowerCase(strg, search=re.compile(r'[^a-z]').search): @@ -216,14 +227,12 @@ class use_ufs(): def __init__(self, button3): self.button3 = button3 - self.box1 = Gtk.VBox(False, 0) - self.box1.show() - box2 = Gtk.HBox(False, 0) - self.box1.pack_start(box2, True, True, 0) - box2.show() + self.vbox1 = Gtk.VBox(False, 0) + self.vbox1.show() # Title - Title = Gtk.Label("UFS Full Disk Configuration") - Title.set_use_markup(True) + label = Gtk.Label("UFS Full Disk Configuration", name="Header") + label.set_property("height-request", 40) + self.vbox1.pack_start(label, False, False, 0) # Chose disk sw = Gtk.ScrolledWindow(hexpand=True, vexpand=True) sw.set_shadow_type(Gtk.ShadowType.ETCHED_IN) @@ -345,9 +354,13 @@ class use_ufs(): self.fs = "UFS+SUJ" grid = Gtk.Grid() grid.set_row_spacing(10) + grid.set_margin_left(10) + grid.set_margin_right(10) + grid.set_margin_top(10) + grid.set_margin_bottom(10) # grid.set_column_homogeneous(True) # grid.set_row_homogeneous(True) - grid.attach(Title, 0, 0, 9, 2) + # grid.attach(Title, 0, 0, 9, 2) grid.attach(mirror_check, 0, 2, 1, 1) grid.attach(self.mirrorbl_box, 1, 2, 1, 1) grid.attach(label, 0, 9, 2, 1) @@ -367,12 +380,12 @@ class use_ufs(): # grid.attach(self.vpasswd_label, 1, 11, 1, 1) # grid.attach(self.repassword, 2, 11, 2, 1) # grid.attach(self.img, 4, 11, 2, 1) - box2.pack_start(grid, True, True, 10) + self.vbox1.pack_start(grid, True, True, 0) return def get_model(self): del ufs_dsk_list[:] - return self.box1 + return self.vbox1 def digit_only(self, *args): text = self.swap_entry.get_text().strip() diff --git a/src/use_zfs.py b/src/use_zfs.py index 32387f2..9c38e45 100644 --- a/src/use_zfs.py +++ b/src/use_zfs.py @@ -28,7 +28,7 @@ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """ -from gi.repository import Gtk +from gi.repository import Gtk, Gdk import os import os.path import re @@ -56,6 +56,18 @@ global zfs_dsk_list zfs_dsk_list = [] +cssProvider = Gtk.CssProvider() +# if os.path.exists(rcconfgbsd): +# print(True) +cssProvider.load_from_path('/usr/local/lib/gbinstall/ghostbsd-style.css') +# elif os.path.exists(rcconfdbsd): +# cssProvider.load_from_path('/usr/local/lib/gbi/desktopbsd-style.css') +screen = Gdk.Screen.get_default() +styleContext = Gtk.StyleContext() +styleContext.add_provider_for_screen(screen, cssProvider, + Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) + + # Find if pasword contain only lower case and number def lowerCase(strg, search=re.compile(r'[^a-z]').search): return not bool(search(strg)) @@ -283,14 +295,12 @@ class ZFS(): def __init__(self, button3): self.button3 = button3 - self.box1 = Gtk.VBox(False, 0) - self.box1.show() - box2 = Gtk.HBox(False, 0) - self.box1.pack_start(box2, True, True, 0) - box2.show() + self.vbox1 = Gtk.VBox(False, 0) + self.vbox1.show() # Title - Title = Gtk.Label("ZFS Configuration") - Title.set_use_markup(True) + label = Gtk.Label("ZFS Full Disk Configuration", name="Header") + label.set_property("height-request", 40) + self.vbox1.pack_start(label, False, False, 0) # Chose disk sw = Gtk.ScrolledWindow(hexpand=True, vexpand=True) sw.set_shadow_type(Gtk.ShadowType.ETCHED_IN) @@ -420,9 +430,13 @@ class ZFS(): # table = Gtk.Table(12, 12, True) grid = Gtk.Grid() grid.set_row_spacing(10) + grid.set_margin_left(10) + grid.set_margin_right(10) + grid.set_margin_top(10) + grid.set_margin_bottom(10) # grid.set_column_homogeneous(True) # grid.set_row_homogeneous(True) - grid.attach(Title, 1, 0, 8, 2) + # grid.attach(Title, 1, 0, 8, 2) grid.attach(mirror_label, 1, 2, 1, 1) grid.attach(mirror_box, 2, 2, 1, 1) # grid.attach(label, 6, 2, 2, 1) @@ -443,11 +457,11 @@ class ZFS(): # grid.attach(self.vpasswd_label, 1, 11, 1, 1) # grid.attach(self.repassword, 2, 11, 2, 1) # grid.attach(self.img, 4, 11, 2, 1) - box2.pack_start(grid, True, True, 10) + self.vbox1.pack_start(grid, True, True, 0) return def get_model(self): - return self.box1 + return self.vbox1 def digit_only(self, *args): text = self.swap_entry.get_text().strip()