40
39
SYS76LOGO_IMAGE = os.path.join(IMAGEDIR, 'logo.png')
41
40
SYS76SQUARE_LOGO = os.path.join(IMAGEDIR, 'logoSQUARE.png')
42
41
WINDOW_ICON = os.path.join(IMAGEDIR, '76icon.svg')
45
43
def setNotify(icon, text): #Allows us to set the notification text and icon in the bottom of the window
46
44
notifyIcon = builder.get_object("notifyImage")
57
55
#Creates an archive of common support files and logs
58
56
if os.path.isfile(lockFile) == True:
59
57
print("FAIL: System76 Driver is currently locked! Wait for it to finish. If this error persists, please reboot.")
60
setNotify("gtk-dialog-error", "The driver is currently processing other operations.\nPlease wait for it to finish")
58
setNotify("gtk-dialog-error", "The driver is currently processing another operation.\nPlease wait for it to finish")
62
60
os.system('touch ' + lockFile)
63
61
username = getpass.getuser()
88
86
# os.system('sudo chmod 777 /home/%s/logs.tar' % username)
89
87
os.system('rm ' + lockFile)
91
setNotify("gtk-ok", "File (logs.tar) created in your home folder. Please\nsend it to support at www.system76.com/support")
89
setNotify("gtk-ok", "A log file (logs.tar) was created in your home folder. Please send it to\nsupport via www.system76.com/support")
93
91
#########################
94
92
## Driver installation ##
102
100
GObject.idle_add(setNotify, "gtk-execute", "Now installing drivers. This may take a while...")
104
102
if driverscontrol.installDrivers() == "true":
105
GObject.idle_add(setNotify, "gtk-dialog-info", "All of your drivers for this system\nare provided by Ubuntu.")
103
GObject.idle_add(setNotify, "gtk-dialog-info", "All of the drivers for this system are provided by Ubuntu.")
107
105
os.system('rm ' + lockFile)
109
GObject.idle_add(setNotify, "gtk-apply", "Installation finished!\nReboot your machine now.")
107
GObject.idle_add(setNotify, "gtk-apply", "Installation is complete! Reboot your machine for the changes to take effect.")
111
109
os.system('rm ' + lockFile)
114
112
#Manages installing the driver
115
113
if os.path.isfile(lockFile) == True:
116
114
print("FAIL: System76 Driver is currently locked! Wait for it to finish. If this error persists, please reboot.")
117
setNotify("gtk-dialog-error", "The driver is currently processing other operations.\nPlease wait for it to finish")
115
setNotify("gtk-dialog-error", "The driver is currently processing another operation.\nPlease wait for it to finish")
118
116
elif detect.connectivityCheck() == "noConnectionExists": #Check to ensure there's a connection
119
117
print("FAIL: No internet connection, or connection to server down.")
120
setNotify("gtk-dialog-warning", "You are not currently connected to the internet!\nPlease establish a wired or wireless connetion.")
118
setNotify("gtk-dialog-warning", "You are not currently connected to the internet!\nPlease establish a wired or wireless internet connection.")
121
119
elif detect.aptcheck() == "running": #Check if there's an APT process running.
122
120
print("FAIL: Another APT process running. Please close it and retry or reboot")
123
setNotify("gtk-dialog-warning", "A package manager is running!\nPlease close it or reboot.")
121
setNotify("gtk-dialog-warning", "A package manager is running! Please close it or\nreboot your system.")
125
123
os.system('touch ' + lockFile)
126
124
print("NOTE: Installing Drivers")
136
134
threading.Thread.__init__(self)
139
GObject.idle_add(setNotify, "gtk-execute", "Now restoring factory settings.\nThis may take a while...")
137
GObject.idle_add(setNotify, "gtk-execute", "Now restoring factory settings. This may take a while...")
141
139
base_system.app_install()
142
140
driverscontrol.installDrivers()
143
141
os.system('rm ' + lockFile)
144
GObject.idle_add(setNotify, "gtk-apply", "System restore finished! Reboot your machine now.")
142
GObject.idle_add(setNotify, "gtk-apply", "System restore is complete! Reboot your machine for\nthe changes to take effect.")
147
145
def onRestoreClicked(driverRestore):
148
146
#This method restores the system to factory state.
149
147
if os.path.isfile(lockFile) == True:
150
148
print("FAIL: System76 Driver is currently locked! Wait for it to finish. If this error persists, please reboot.")
151
setNotify("gtk-dialog-error", "The driver is currently processing other operations.\nPlease wait for it to finish")
149
setNotify("gtk-dialog-error", "The driver is currently processing another operation.\nPlease wait for it to finish")
152
150
elif detect.connectivityCheck() == "noConnectionExists": #Check to ensure there's a connection
153
setNotify("gtk-dialog-warning", "You are not currently connected to the internet!\nPlease establish a wired or wireless connetion.")
151
setNotify("gtk-dialog-warning", "You are not currently connected to the internet!\nPlease establish a wired or wireless internet connetion.")
154
152
elif detect.aptcheck() == "running": #Check if there's an APT process running.
155
153
setNotify("gtk-dialog-warning", "A package manager is running!\nPlease close it or reboot.")
203
201
"onCreateClicked": onCreateClicked,
204
202
"onCloseClicked": Gtk.main_quit,
205
203
"onAboutClicked": onAboutClicked,
206
"onDetailsClicked": onDetailsClicked,
208
205
builder.connect_signals(handlers)
254
251
#set the strings and labels
255
252
modelName.set_text(system.name())
256
253
modelNumber.set_text(model.determine_model())
257
oSystem.set_text(ubuntuversion.getOsName() + " Version:")
254
oSystem.set_text(ubuntuversion.getOsName() + " Version")
258
255
ubuntuVersion.set_text(ubuntuversion.getVersion())
259
256
driverVersion.set_text(programVersion)
258
#set up the drivers details pane
259
b = open(descriptionFile)
262
builder.get_object("detailsText").set_text(d)
261
264
#show the window.
262
265
builder.get_object("mainWindow").show()
272
275
if getSupported() == True:
273
276
if driversdescribe.describeDrivers() == "true":
274
277
os.system("echo 'All of the drivers for this system are provided by Ubuntu.' > " + descriptionFile)
278
os.system("cat " + descriptionFile)
276
os.system("echo 'The following drivers/fixes will be installed:' > " + descriptionFile)
277
driversdescribe.describeDrivers()
278
os.system("cat " + descriptionFile)
280
os.system("cat " + descriptionFile)
279
281
system76Driver().run()
281
283
notSupport().run()