Skip to content
Snippets Groups Projects
Commit ae3c820f authored by Martyn Gigg's avatar Martyn Gigg
Browse files

Remove reading user settings that are not being saved yet.

This required ensuring that the log diplay can have the correct default
priority.
Refs #21567
parent 9a86cc79
No related branches found
No related tags found
No related merge requests found
......@@ -181,7 +181,6 @@ class MainWindow(QMainWindow):
self.widgets.append(self.workspacewidget)
self.setup_layout()
self.read_user_settings()
self.create_actions()
self.populate_menus()
......@@ -325,10 +324,6 @@ class MainWindow(QMainWindow):
row[0].dockwidget.show()
row[0].dockwidget.raise_()
def read_user_settings(self):
for widget in self.widgets:
widget.read_user_settings(CONF.qsettings)
# ----------------------- Slots ---------------------------------
def open_file(self):
# todo: when more file types are added this should
......
......@@ -27,6 +27,9 @@ from qtpy.QtWidgets import QHBoxLayout
# local imports
from workbench.plugins.base import PluginWidget
# Default logs at notice
DEFAULT_LOG_PRIORITY = 5
class LogMessageDisplay(PluginWidget):
......@@ -53,7 +56,7 @@ class LogMessageDisplay(PluginWidget):
self.display.readSettings(qsettings)
def register_plugin(self, menu=None):
self.display.attachLoggingChannel()
self.display.attachLoggingChannel(DEFAULT_LOG_PRIORITY)
self._capture_stdout_and_stderr()
self.main.add_dockwidget(self)
......
......@@ -52,7 +52,7 @@ class MessageDisplay : QWidget, Configurable {
public:
MessageDisplay(QWidget *parent = 0);
void attachLoggingChannel();
void attachLoggingChannel(int logLevel = -1);
void appendFatal(const QString &text);
void appendError(const QString &text);
......@@ -233,4 +233,4 @@ class ManageUserDirectories : QDialog {
%End
public:
ManageUserDirectories(QWidget *parent /TransferThis/ = nullptr);
};
\ No newline at end of file
};
......@@ -54,7 +54,7 @@ public:
~MessageDisplay() override;
// Setup logging framework connections
void attachLoggingChannel();
void attachLoggingChannel(int logLevel = 0);
/// If set, only Mantid log messages from this source are emitted
void setSource(const QString &source);
/// Get the current source are emitted
......
......@@ -41,11 +41,11 @@ namespace MantidWidgets {
* at the group containing the values
*/
void MessageDisplay::readSettings(const QSettings &storage) {
ConfigService::Instance().setFilterChannelLogLevel(
m_filterChannelName,
storage.value("MessageDisplayPriority", Message::Priority::PRIO_NOTICE)
.toInt(),
true);
const int logLevel = storage.value("MessageDisplayPriority", 0).toInt();
if (logLevel > 0) {
ConfigService::Instance().setFilterChannelLogLevel(m_filterChannelName,
logLevel, true);
}
}
/**
......@@ -92,8 +92,10 @@ MessageDisplay::~MessageDisplay() {
/**
* Attaches the Mantid logging framework. Starts the ConfigService if
* required
* @param logLevel If > 0 then set the filter channel level to this. A
* number =< 0 uses the channel
*/
void MessageDisplay::attachLoggingChannel() {
void MessageDisplay::attachLoggingChannel(int logLevel) {
// Setup logging. ConfigService needs to be started
auto &configSvc = ConfigService::Instance();
auto &rootLogger = Poco::Logger::root();
......@@ -109,7 +111,9 @@ void MessageDisplay::attachLoggingChannel() {
configSvc.registerLoggingFilterChannel(m_filterChannelName, m_filterChannel);
connect(m_logChannel, SIGNAL(messageReceived(const Message &)), this,
SLOT(append(const Message &)));
if (logLevel > 0) {
configSvc.setFilterChannelLogLevel(m_filterChannelName, logLevel, true);
}
++ATTACH_COUNT;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment