-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlinpack.py
More file actions
63 lines (49 loc) · 2.23 KB
/
Copy pathlinpack.py
File metadata and controls
63 lines (49 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import configparser
def load_linpack_config(ui):
"""
Load settings from the [Linpack] section of config.ini and update the GUI combo boxes.
Args:
ui: The UI object from mainwindow.py containing the GUI elements.
"""
config = configparser.ConfigParser()
config.read('config.ini')
if 'Linpack' in config:
linpack = config['Linpack']
# Load version setting into linpack_version_comboBox
version = linpack.get('version', '2021') # Default to '2021' if not found
ui.linpack_version_comboBox.setCurrentText(version)
# Load mode setting into linpack_mode_comboBox
mode = linpack.get('mode', 'Fast') # Default to 'Fast' if not found
ui.linpack_mode_comboBox.setCurrentText(mode)
# Load memory setting into linpack_memory_comboBox
memory = linpack.get('memory', '6GB') # Default to '6GB' if not found
ui.linpack_memory_comboBox.setCurrentText(memory)
else:
# If [Linpack] section doesn't exist, set combo boxes to their first item
ui.linpack_version_comboBox.setCurrentIndex(0)
ui.linpack_mode_comboBox.setCurrentIndex(0)
ui.linpack_memory_comboBox.setCurrentIndex(0)
def apply_linpack_config(ui):
"""
Update the [Linpack] section in config.ini based on current GUI combo box selections.
Args:
ui: The UI object from mainwindow.py containing the GUI elements.
"""
config = configparser.ConfigParser()
config.read('config.ini')
# Create [Linpack] section if it doesn't exist
if 'Linpack' not in config:
config['Linpack'] = {}
linpack = config['Linpack']
# Update version setting from linpack_version_comboBox
version = ui.linpack_version_comboBox.currentText()
linpack['version'] = version
# Update mode setting from linpack_mode_comboBox
mode = ui.linpack_mode_comboBox.currentText()
linpack['mode'] = mode
# Update memory setting from linpack_memory_comboBox
memory = ui.linpack_memory_comboBox.currentText()
linpack['memory'] = memory
# Write the updated configuration back to config.ini
with open('config.ini', 'w') as configfile:
config.write(configfile)