Made the console respect theme changes.
This commit is contained in:
parent
ee0b08820f
commit
bd4bc95258
2 changed files with 21 additions and 6 deletions
22
console.py
22
console.py
|
@ -23,6 +23,7 @@ class ConsoleWindow(QtGui.QDialog):
|
|||
#~class ConsoleWindow(styler.PesterBaseWindow):
|
||||
# A simple console class, cobbled together from the corpse of another.
|
||||
|
||||
stylesheet_path = "main/defaultwindow/style"
|
||||
# This is a holder for our text inputs.
|
||||
text = AttrDict()
|
||||
# I should probably put up constants for 'direction' if this is going to
|
||||
|
@ -40,14 +41,10 @@ class ConsoleWindow(QtGui.QDialog):
|
|||
except:
|
||||
self.mainwindow = parent
|
||||
theme = self.mainwindow.theme
|
||||
# This won't initialize the sub-objects, because they don't exist yet.
|
||||
self.initTheme(theme)
|
||||
|
||||
self.text = AttrDict()
|
||||
|
||||
# Set up our style/window specifics
|
||||
self.setStyleSheet(theme["main/defaultwindow/style"])
|
||||
self.setWindowTitle("==> Console")
|
||||
self.resize(350,300)
|
||||
|
||||
self.text.area = ConsoleText(theme, self)
|
||||
self.text.input = ConsoleInput(theme, self)
|
||||
self.text.input.setFocus()
|
||||
|
@ -116,6 +113,19 @@ class ConsoleWindow(QtGui.QDialog):
|
|||
parent = self.parent()
|
||||
parent.console.is_open = False
|
||||
|
||||
def initTheme(self, theme):
|
||||
# Set up our style/window specifics
|
||||
self.changeTheme(theme)
|
||||
self.resize(350,300)
|
||||
|
||||
def changeTheme(self, theme):
|
||||
self.setStyleSheet(theme[self.stylesheet_path])
|
||||
self.setWindowTitle("==> Console")
|
||||
if "area" in self.text and "input" in self.text:
|
||||
self.text.area.changeTheme(theme)
|
||||
self.text.input.changeTheme(theme)
|
||||
|
||||
|
||||
# Actual console stuff.
|
||||
def execInConsole(self, scriptstr, env=None):
|
||||
# Since that's what imports *us*, this should be okay
|
||||
|
|
|
@ -1776,6 +1776,11 @@ class PesterWindow(MovingWindow):
|
|||
else:
|
||||
self.mychumcolor.setText("")
|
||||
|
||||
if _CONSOLE:
|
||||
if self.console.window:
|
||||
# A bit of an ugly hack....
|
||||
self.console.window.changeTheme(theme)
|
||||
|
||||
# sounds
|
||||
self._setup_sounds()
|
||||
self.setVolume(self.config.volume())
|
||||
|
|
Loading…
Reference in a new issue