98.1.1
by Mitch Towner
* re-organised directory structure |
1 |
#!/usr/bin/python
|
2 |
# Author: Buran Ayuthia (the.ayuthias@gmail.com)
|
|
3 |
# Author: bmartin (blakecmartin@gmail.com)
|
|
100.1.2
by Samuel A. Dieck K.
*added sam as author to several files |
4 |
# Author: Samuel A. Dieck (https://launchpad.net/~sam-dieck)
|
100.1.1
by Drew Johnson
+ Update README |
5 |
# Author: Drew Johnson (https://launchpad.net/~nuboon2age)
|
98.1.1
by Mitch Towner
* re-organised directory structure |
6 |
|
7 |
"""
|
|
8 |
This file is part of WiFix.
|
|
9 |
||
10 |
WiFix is free software; you can redistribute it and/or modify
|
|
11 |
it under the terms of the GNU General Public License as published by
|
|
12 |
the Free Software Foundation; either version 2 of the License, or
|
|
13 |
(at your option) any later version.
|
|
14 |
||
15 |
WiFix is distributed in the hope that it will be useful,
|
|
16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
18 |
GNU General Public License for more details.
|
|
19 |
||
20 |
You should have received a copy of the GNU General Public License
|
|
21 |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
22 |
"""
|
|
23 |
||
24 |
from PyQt4.QtCore import SIGNAL, SLOT |
|
25 |
from PyQt4.QtGui import QApplication, QWidget, QTextEdit, QGridLayout, QPushButton, QRadioButton |
|
26 |
import wifixui |
|
27 |
||
28 |
import os |
|
29 |
import sys |
|
30 |
||
31 |
import messages |
|
32 |
import platforms |
|
33 |
import pm |
|
34 |
import threading |
|
35 |
import commands |
|
36 |
import webbrowser |
|
37 |
||
38 |
global app |
|
39 |
app = QApplication(sys.argv) |
|
40 |
||
41 |
class GraphicalUI(wifixui.WifixUI, QWidget): |
|
42 |
||
100.1.1
by Drew Johnson
+ Update README |
43 |
def build_driver_options_array(self, driver_details_set): |
44 |
driver_options_array = [] |
|
45 |
for driver_option_detail in driver_details_set: |
|
46 |
label = driver_option_detail['label'] |
|
47 |
driver = driver_option_detail['driver'] |
|
48 |
arguments = driver_option_detail['arguments'] |
|
98.1.1
by Mitch Towner
* re-organised directory structure |
49 |
driver_type='compiled from source' |
50 |
if arguments.find(' -inf ') != -1: |
|
51 |
driver_type='Windows/NDIS' |
|
52 |
install_msg = label + '\nDriver: ' + driver + ' (' + driver_type + ')' |
|
100.1.1
by Drew Johnson
+ Update README |
53 |
driver_option = QRadioButton(install_msg, self) |
98.1.1
by Mitch Towner
* re-organised directory structure |
54 |
self.arg_list = self.platform.get_installer_command(arguments) |
100.1.1
by Drew Johnson
+ Update README |
55 |
# self.arg_list.append(driver_options_array_button)
|
56 |
driver_option.connect(driver_option, SIGNAL("toggled(bool)"), self.use_command) |
|
57 |
driver_options_array.append(driver_option) |
|
58 |
return driver_options_array |
|
98.1.1
by Mitch Towner
* re-organised directory structure |
59 |
|
60 |
def check_programs(self): |
|
98.1.2
by Samuel A. Dieck K.
added support for 'kdesudo' |
61 |
return self.program_exists("echo") and self.program_exists("grep") and self.program_exists("id") and (self.program_exists("kdesu") or self.program_exists("kdesudo")) and self.program_exists("lshw") and self.program_exists("lspci") and self.program_exists("lsusb") and self.program_exists("sed") and self.program_exists("zenity") |
98.1.1
by Mitch Towner
* re-organised directory structure |
62 |
|
63 |
def close_application(self): |
|
64 |
self.close() |
|
65 |
||
66 |
def get_progress_meter(self): |
|
67 |
return pm.ProgressMonitor() |
|
68 |
||
69 |
def run_installer(self): |
|
70 |
self.platform.execute(self.perform) |
|
71 |
self.close_application() |
|
72 |
||
100.1.1
by Drew Johnson
+ Update README |
73 |
def start(self, driver_options_array): |
98.1.1
by Mitch Towner
* re-organised directory structure |
74 |
row = 0 |
75 |
self.MainLayout.setSpacing(10) |
|
76 |
self.MainLayout.addWidget(self.TextMsg, row, 0) |
|
77 |
row += 1 |
|
100.1.1
by Drew Johnson
+ Update README |
78 |
for driver_option in driver_options_array: |
79 |
self.MainLayout.addWidget(driver_option, row, 0) |
|
80 |
driver_options_array_button.show() |
|
98.1.1
by Mitch Towner
* re-organised directory structure |
81 |
row += 1 |
100.1.1
by Drew Johnson
+ Update README |
82 |
driver_options_array[0].setChecked(True) |
98.1.1
by Mitch Towner
* re-organised directory structure |
83 |
|
84 |
self.Button = QPushButton("Install", self) |
|
85 |
self.Button.connect(self.Button, SIGNAL("clicked()"), self.run_installer) |
|
86 |
self.MainLayout.addWidget(self.Button, row, 0) |
|
87 |
||
88 |
self.show() |
|
89 |
sys.exit(app.exec_()) |
|
90 |
||
100.1.1
by Drew Johnson
+ Update README |
91 |
def submit_card_data(self, data=None): |
92 |
print "TODO implement the <wifix qt version>.submit_card_data" |
|
93 |
||
98.1.1
by Mitch Towner
* re-organised directory structure |
94 |
def sudo(self, title, command): |
100.1.2
by Samuel A. Dieck K.
*added sam as author to several files |
95 |
if (self.program_exists ("kdesu")): |
96 |
return "kdesu -c '" + command + "' --caption '" + title + "'" |
|
97 |
else: #kdesudo instead of kdesu |
|
98 |
return "kdesudo -c '" + command + "' --caption '" + title + "'" |
|
98.1.1
by Mitch Towner
* re-organised directory structure |
99 |
|
100 |
def use_command(self): |
|
101 |
val = self.arg_list |
|
102 |
self.perform = self.sudo("Run installer", val) |
|
103 |
||
104 |
def __init__(self, platform): |
|
103
by Samuel A. Dieck K.
updated the readme, disabled qt interface due to some bugs and lack of testing |
105 |
print "QT not yet implemented, please use gtk interface" |
106 |
sys.exit (0); |
|
98.1.1
by Mitch Towner
* re-organised directory structure |
107 |
self.platform = platform |
108 |
QWidget.__init__(self) |
|
109 |
||
110 |
self.device_info = '' |
|
111 |
||
112 |
self.setWindowTitle("WiFix Wireless Driver Installer") |
|
113 |
||
114 |
self.MainLayout = QGridLayout(self) |
|
115 |
||
116 |
self.TextMsg = QTextEdit(self) |
|
117 |
self.TextMsg.setReadOnly(True) |
|
118 |
self.TextMsg.setText("Welcome to WiFix!!!!") |