Skip to content

Commit

Permalink
Move logger to dock widget.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey Naydenov authored and Alexey Naydenov committed May 30, 2014
1 parent 4e9024e commit 1b605ef
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 34 deletions.
1 change: 1 addition & 0 deletions .projectile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-/doc
24 changes: 0 additions & 24 deletions vitables/preferences/vtconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,21 +280,6 @@ def hsplitterPosition(self):
else:
return default_value


def vsplitterPosition(self):
"""
Returns the vertical splitter geometry setting.
"""

key = 'Geometry/VSplitter'
default_value = None
setting_value = self.value(key)
if isinstance(setting_value, QtCore.QByteArray):
return setting_value
else:
return default_value


def startupLastSession(self):
"""
Returns the `Restore last session` setting.
Expand Down Expand Up @@ -460,7 +445,6 @@ def readConfiguration(self):
config['Geometry/Position'] = self.windowPosition()
config['Geometry/Layout'] = self.windowLayout()
config['Geometry/HSplitter'] = self.hsplitterPosition()
config['Geometry/VSplitter'] = self.vsplitterPosition()
config['Recent/Files'] = self.recentFiles()
config['Session/Files'] = self.sessionFiles()
config['HelpBrowser/History'] = self.helpHistory()
Expand Down Expand Up @@ -506,8 +490,6 @@ def saveConfiguration(self):
self.writeValue('Geometry/Layout', vtgui.saveState())
# Horizontal splitter geometry
self.writeValue('Geometry/HSplitter', vtgui.hsplitter.saveState())
# Vertical splitter geometry
self.writeValue('Geometry/VSplitter', vtgui.vsplitter.saveState())
# The list of recent files
self.writeValue('Recent/Files', self.recent_files)
# The list of session files and nodes
Expand Down Expand Up @@ -597,12 +579,6 @@ def loadConfiguration(self, config):
# Default geometry provided by the underlying Qt installation
gui.hsplitter.restoreState(value)

key = 'Geometry/VSplitter'
value = config[key]
if isinstance(value, QtCore.QByteArray):
# Default geometry provided by the underlying Qt installation
gui.vsplitter.restoreState(value)

key = 'Startup/lastWorkingDir'
self.last_working_directory = config[key]

Expand Down
25 changes: 15 additions & 10 deletions vitables/vtgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,11 @@ def addComponents(self):
self.setWindowIcon(self.icons_dictionary['vitables_wm'])
central_widget = QtGui.QWidget(self)
central_layout = QtGui.QVBoxLayout(central_widget)
self.vsplitter = QtGui.QSplitter(QtCore.Qt.Vertical, central_widget)
central_layout.addWidget(self.vsplitter)
self.setCentralWidget(central_widget)

# Divide the top region of the window into 2 regions and put there
# the workspace. The tree of databases will be added later on
self.hsplitter = QtGui.QSplitter(self.vsplitter)
self.hsplitter = QtGui.QSplitter(QtCore.Qt.Horizontal, central_widget)
central_layout.addWidget(self.hsplitter)
self.setCentralWidget(central_widget)
self.hsplitter.addWidget(self.dbs_tree_view)
self.workspace = QtGui.QMdiArea(self.hsplitter)
sb_as_needed = QtCore.Qt.ScrollBarAsNeeded
Expand All @@ -124,10 +122,18 @@ def addComponents(self):
)

# Put the logging console in the bottom region of the window
self.logger = logger.Logger(self.vsplitter)
self.logger_dock = QtGui.QDockWidget('Log')
self.logger_dock.setObjectName('LoggerDockWindow')
self.logger_dock.setFeatures(
QtGui.QDockWidget.DockWidgetClosable
| QtGui.QDockWidget.DockWidgetMovable
| QtGui.QDockWidget.DockWidgetFloatable)
self.addDockWidget(QtCore.Qt.BottomDockWidgetArea, self.logger_dock)
self.logger = logger.Logger()
self.logger_dock.setWidget(self.logger)
# Redirect standard output and standard error to a Logger instance
#sys.stdout = self.logger
#sys.stderr = self.logger
sys.stdout = self.logger
sys.stderr = self.logger
# add self.logger as handler of main logger object
vitables_logger = logging.getLogger('vitables')
stream_handler = logging.StreamHandler(self.logger)
Expand All @@ -136,9 +142,8 @@ def addComponents(self):

# The signal mapper used to keep the the Window menu updated
self.window_mapper = QtCore.QSignalMapper(self)
self.window_mapper.mapped[QtGui.QWidget].connect(\
self.window_mapper.mapped[QtGui.QWidget].connect(
self.workspace.setActiveSubWindow)

self.workspace.installEventFilter(self)


Expand Down

0 comments on commit 1b605ef

Please sign in to comment.