mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-20 14:20:59 +00:00
Reload text file configuration after GUI changed it.
This commit is contained in:
parent
10d6e81af3
commit
7cd67d29cf
3 changed files with 13 additions and 1 deletions
|
|
@ -12,6 +12,7 @@ Features:
|
|||
is not installed.
|
||||
- gui: Highlight check results and colorize number of errors in
|
||||
output statistics.
|
||||
- gui: Reload configuration after changes have been made in the editor.
|
||||
|
||||
|
||||
6.8 "Ghost in the shell" (released 26.4.2011)
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@ class LinkCheckerMain (QtGui.QMainWindow, Ui_MainWindow):
|
|||
self.init_treeview()
|
||||
self.connect_widgets()
|
||||
self.init_config()
|
||||
self.read_config()
|
||||
self.init_app()
|
||||
|
||||
def init_app (self):
|
||||
|
|
@ -139,6 +140,7 @@ class LinkCheckerMain (QtGui.QMainWindow, Ui_MainWindow):
|
|||
self.log_url_signal.connect(self.model.log_url)
|
||||
self.log_stats_signal.connect(self.log_stats)
|
||||
self.error_signal.connect(self.internal_error)
|
||||
self.options.editor.saved.connect(self.read_config)
|
||||
|
||||
def init_treeview (self):
|
||||
"""Set treeview model and layout."""
|
||||
|
|
@ -171,7 +173,9 @@ class LinkCheckerMain (QtGui.QMainWindow, Ui_MainWindow):
|
|||
self.handler = GuiLogHandler(self.debug.log_msg_signal)
|
||||
status = StatusLogger(self.progress.log_status_signal)
|
||||
self.config.init_logging(status, handler=self.handler)
|
||||
# read user and system configuration file
|
||||
|
||||
def read_config (self, filename=None):
|
||||
"""Read user and system configuration file."""
|
||||
try:
|
||||
self.config.read()
|
||||
except LinkCheckerError, msg:
|
||||
|
|
|
|||
|
|
@ -28,6 +28,11 @@ except ImportError:
|
|||
class EditorWindow (QtGui.QDialog, Ui_EditorDialog):
|
||||
"""Editor window."""
|
||||
|
||||
# emitted after successful save
|
||||
saved = QtCore.pyqtSignal(str)
|
||||
# emitted after successful load
|
||||
loaded = QtCore.pyqtSignal(str)
|
||||
|
||||
def __init__ (self, parent=None):
|
||||
"""Initialize the editor widget."""
|
||||
super(EditorWindow, self).__init__(parent)
|
||||
|
|
@ -98,6 +103,7 @@ class EditorWindow (QtGui.QDialog, Ui_EditorDialog):
|
|||
stream.setCodec("UTF-8")
|
||||
stream << self.editor.text()
|
||||
self.editor.setModified(False)
|
||||
self.saved.emit(self.filename)
|
||||
except (IOError, OSError), e:
|
||||
err = QtGui.QMessageBox(self)
|
||||
err.setText(str(e))
|
||||
|
|
@ -127,6 +133,7 @@ class EditorWindow (QtGui.QDialog, Ui_EditorDialog):
|
|||
stream = QtCore.QTextStream(fh)
|
||||
stream.setCodec("UTF-8")
|
||||
self.setText(stream.readAll())
|
||||
self.loaded.emit(self.filename)
|
||||
except (IOError, OSError), e:
|
||||
err = QtGui.QMessageBox(self)
|
||||
err.setText(str(e))
|
||||
|
|
|
|||
Loading…
Reference in a new issue