# Path: firstboot_lib/firstbootconfig.py
# class project_path_not_found(Exception):
# def get_bin_path():
# def get_data_file(*path_segments):
# def get_prefix():
# def get_data_path():
# def get_version():
# 
# Path: firstboot_lib/FirstbootEntry.py
# class FirstbootEntry(IniFile):
# 
#     default_group = 'Firstboot Entry'
# 
#     def __init__(self):
# 
#         self.content = dict()
# 
#         self.config_path = '/var/lib/firstboot'
#         self.config_file = os.path.join(self.config_path, 'firstboot.conf')
# 
#         if not os.path.exists(self.config_path):
#             os.makedirs(self.config_path)
# 
#         if not os.path.exists(self.config_file):
#             self._create_config_file()
# 
#         IniFile.parse(self, self.config_file, [self.default_group])
# 
#     def _create_config_file(self):
# 
#         fd = open(self.config_file, 'w')
#         if fd != None:
#             fd.write('[Firstboot Entry]\n')
#             fd.write('firststart=0\n')
#             fd.write('\n')
#             fd.write('[LinkToServer]\n')
#             fd.write('url=https://GECOS-SERVER/autoconfig\n')
#             fd.write('\n')
#             fd.close()
# 
#     def get_firststart(self):
#         fs = self.get('firststart').strip()
#         fs = bool(int(fs))
#         return fs
# 
#     def set_firststart(self, value):
#         self.set('firststart', value)
#         self.write()
# 
#     def get_url(self):
#         return self.get('url', group='LinkToServer')
# 
#     def set_url(self, value):
#         self.set('url', value, group='LinkToServer')
#         self.write()


import gettext
import math
import shlex
import subprocess
import os
import logging
import pages
import dbus
from gettext import gettext as _
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import Pango
from gi.repository import Gio
from gi.repository import GdkPixbuf
from gi.repository import GObject
from firstboot_lib import Window, firstbootconfig, FirstbootEntry
from dbus.mainloop.glib import DBusGMainLoop
NM_STATE_DISCONNECTED = 20    # There is no active network connection.
NM_STATE_DISCONNECTING = 30    # Network connections are being cleaned up.
NM_STATE_CONNECTING = 40    # A network device is connecting to a network and there is no other available network connection.
NM_STATE_CONNECTED_LOCAL = 50    # A network device is connected, but there is only link-local connectivity.
NM_STATE_CONNECTED_SITE = 60    # A network device is connected, but there is only site-local connectivity.
NM_STATE_CONNECTED_GLOBAL = 70    # A network device is connected, with global network connectivity.


# See firstboot_lib.Window.py for more details about how this class works
class FirstbootWindow(Window):
    __gtype_name__ = "FirstbootWindow"

    __gsignals__ = {
        'link-status': (GObject.SignalFlags.ACTION, None, (GObject.TYPE_BOOLEAN,))
    }

    def finish_initializing(self, builder, options=None):   # pylint: disable=E1002
        """Set up the main window"""
        super(FirstbootWindow, self).finish_initializing(builder)
        self.connect("delete_event", self.on_delete_event)

        screen = Gdk.Screen.get_default()
        sw = math.floor(screen.width() - screen.width() / 6)
        sh = math.floor(screen.height() - screen.height() / 6)
        self.resize(sw, sh)

        self.btnPrev = self.ui.btnPrev
        self.btnNext = self.ui.btnNext

        self.cmd_options = options

# Path: firstboot_lib/firstbootconfig.py
# class project_path_not_found(Exception):
# def get_bin_path():
# def get_data_file(*path_segments):
# def get_prefix():
# def get_data_path():
# def get_version():
# 
# Path: firstboot_lib/FirstbootEntry.py
# class FirstbootEntry(IniFile):
# 
#     default_group = 'Firstboot Entry'
# 
#     def __init__(self):
# 
#         self.content = dict()
# 
#         self.config_path = '/var/lib/firstboot'
#         self.config_file = os.path.join(self.config_path, 'firstboot.conf')
# 
#         if not os.path.exists(self.config_path):
#             os.makedirs(self.config_path)
# 
#         if not os.path.exists(self.config_file):
#             self._create_config_file()
# 
#         IniFile.parse(self, self.config_file, [self.default_group])
# 
#     def _create_config_file(self):
# 
#         fd = open(self.config_file, 'w')
#         if fd != None:
#             fd.write('[Firstboot Entry]\n')
#             fd.write('firststart=0\n')
#             fd.write('\n')
#             fd.write('[LinkToServer]\n')
#             fd.write('url=https://GECOS-SERVER/autoconfig\n')
#             fd.write('\n')
#             fd.close()
# 
#     def get_firststart(self):
#         fs = self.get('firststart').strip()
#         fs = bool(int(fs))
#         return fs
# 
#     def set_firststart(self, value):
#         self.set('firststart', value)
#         self.write()
# 
#     def get_url(self):
#         return self.get('url', group='LinkToServer')
# 
#     def set_url(self, value):
#         self.set('url', value, group='LinkToServer')
#         self.write()


# Path: firstboot/FirstbootWindow.py
import gettext
import math
import shlex
import subprocess
import os
import logging
import pages
import dbus
from gettext import gettext as _
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import Pango
from gi.repository import Gio
from gi.repository import GdkPixbuf
from gi.repository import GObject
from firstboot_lib import Window, firstbootconfig, FirstbootEntry
from dbus.mainloop.glib import DBusGMainLoop

NM_STATE_DISCONNECTED = 20    # There is no active network connection.
NM_STATE_DISCONNECTING = 30    # Network connections are being cleaned up.
NM_STATE_CONNECTING = 40    # A network device is connecting to a network and there is no other available network connection.
NM_STATE_CONNECTED_LOCAL = 50    # A network device is connected, but there is only link-local connectivity.
NM_STATE_CONNECTED_SITE = 60    # A network device is connected, but there is only site-local connectivity.
NM_STATE_CONNECTED_GLOBAL = 70    # A network device is connected, with global network connectivity.


# See firstboot_lib.Window.py for more details about how this class works
class FirstbootWindow(Window):
    __gtype_name__ = "FirstbootWindow"

    __gsignals__ = {
        'link-status': (GObject.SignalFlags.ACTION, None, (GObject.TYPE_BOOLEAN,))
    }

    def finish_initializing(self, builder, options=None):   # pylint: disable=E1002
        """Set up the main window"""
        super(FirstbootWindow, self).finish_initializing(builder)
        self.connect("delete_event", self.on_delete_event)

        screen = Gdk.Screen.get_default()
        sw = math.floor(screen.width() - screen.width() / 6)
        sh = math.floor(screen.height() - screen.height() / 6)
        self.resize(sw, sh)

        self.btnPrev = self.ui.btnPrev
        self.btnNext = self.ui.btnNext

        self.cmd_options = options

        self.fbe = FirstbootEntry.FirstbootEntry()