-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathLogEntriesDialog.py
More file actions
107 lines (89 loc) · 4.07 KB
/
LogEntriesDialog.py
File metadata and controls
107 lines (89 loc) · 4.07 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import Config
from PyQt4 import QtCore, QtGui
from Common import returnResourcePath
class LogEntriesWindow(QtGui.QDialog):
def __init__(self, parent=None):
QtGui.QDialog.__init__(self, parent)
self.settings = Config.settings
# Create dialog
self.setWindowModality(QtCore.Qt.NonModal)
self.setWindowTitle('Log entries')
self.setWindowIcon(QtGui.QIcon(returnResourcePath('images/toggle_entries.png')))
self.vBoxLayout = QtGui.QVBoxLayout(self)
# Add command link buttons
self.systemCommandLinkButton = QtGui.QCommandLinkButton()
self.systemCommandLinkButton.setText('System messages')
icon = QtGui.QIcon(QtGui.QPixmap(returnResourcePath('images/settings.png')))
self.systemCommandLinkButton.setIcon(icon)
self.systemCommandLinkButton.setIconSize(QtCore.QSize(40,40))
self.systemCommandLinkButton.setCheckable(True)
self.vBoxLayout.addWidget(self.systemCommandLinkButton)
self.hatsCommandLinkButton = QtGui.QCommandLinkButton()
self.hatsCommandLinkButton.setText('Hats')
icon = QtGui.QIcon(QtGui.QPixmap(returnResourcePath('images/hat.png')))
self.hatsCommandLinkButton.setIcon(icon)
self.hatsCommandLinkButton.setIconSize(QtCore.QSize(40,40))
self.hatsCommandLinkButton.setCheckable(True)
self.vBoxLayout.addWidget(self.hatsCommandLinkButton)
self.weaponsCommandLinkButton = QtGui.QCommandLinkButton()
self.weaponsCommandLinkButton.setText('Weapons')
icon = QtGui.QIcon(QtGui.QPixmap(returnResourcePath('images/weapon.png')))
self.weaponsCommandLinkButton.setIcon(icon)
self.weaponsCommandLinkButton.setIconSize(QtCore.QSize(40,40))
self.weaponsCommandLinkButton.setCheckable(True)
self.vBoxLayout.addWidget(self.weaponsCommandLinkButton)
self.toolsCommandLinkButton = QtGui.QCommandLinkButton()
self.toolsCommandLinkButton.setText('Tools')
icon = QtGui.QIcon(QtGui.QPixmap(returnResourcePath('images/tool.png')))
self.toolsCommandLinkButton.setIcon(icon)
self.toolsCommandLinkButton.setIconSize(QtCore.QSize(40,40))
self.toolsCommandLinkButton.setCheckable(True)
self.vBoxLayout.addWidget(self.toolsCommandLinkButton)
self.cratesCommandLinkButton = QtGui.QCommandLinkButton()
self.cratesCommandLinkButton.setText('Crates')
icon = QtGui.QIcon(QtGui.QPixmap(returnResourcePath('images/crate.png')))
self.cratesCommandLinkButton.setIcon(icon)
self.cratesCommandLinkButton.setIconSize(QtCore.QSize(40,40))
self.cratesCommandLinkButton.setCheckable(True)
self.vBoxLayout.addWidget(self.cratesCommandLinkButton)
# Add buttons
self.buttonBox = QtGui.QDialogButtonBox()
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setCenterButtons(False)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.vBoxLayout.addWidget(self.buttonBox)
# Signal connections
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL('accepted()'), self.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL('rejected()'), self.reject)
QtCore.QMetaObject.connectSlotsByName(self)
self.populateDetails()
def accept(self):
toggles = ''
if self.systemCommandLinkButton.isChecked():
toggles += 'system,'
if self.hatsCommandLinkButton.isChecked():
toggles += 'hats,'
if self.weaponsCommandLinkButton.isChecked():
toggles += 'weapons,'
if self.toolsCommandLinkButton.isChecked():
toggles += 'tools,'
if self.cratesCommandLinkButton.isChecked():
toggles += 'crates'
if toggles != '':
if toggles[len(toggles)-1] == ',':
toggles = toggles[:len(toggles)-1]
self.settings.set_option('Settings', 'ui_log_entry_toggles', toggles)
self.settings.flush_configuration()
self.close()
def populateDetails(self):
toggles = self.settings.get_option('Settings', 'ui_log_entry_toggles').split(',')
if 'system' in toggles:
self.systemCommandLinkButton.setChecked(True)
if 'hats' in toggles:
self.hatsCommandLinkButton.setChecked(True)
if 'weapons' in toggles:
self.weaponsCommandLinkButton.setChecked(True)
if 'tools' in toggles:
self.toolsCommandLinkButton.setChecked(True)
if 'crates' in toggles:
self.cratesCommandLinkButton.setChecked(True)