Skip to content

Commit

Permalink
Merge branch 'invesalius:master' into context-menu-improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikkauppi authored Jul 3, 2024
2 parents 600cc97 + 8a62bac commit 35d6551
Show file tree
Hide file tree
Showing 7 changed files with 597 additions and 7 deletions.
3 changes: 3 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
except FileNotFoundError:
pass

import invesalius.gui.log as log

class InVesalius(wx.App):
"""
Expand Down Expand Up @@ -131,6 +132,8 @@ def Startup2(self):
self.SetTopWindow(self.frame)
self.frame.Show()
self.frame.Raise()
#logger = log.MyLogger()
log.invLogger.configureLogging()

# ------------------------------------------------------------------

Expand Down
9 changes: 9 additions & 0 deletions invesalius/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,15 @@
LANGUAGE = 2
SLICE_INTERPOLATION = 3

#------------ Logging options key------------
FILE_LOGGING = 4
FILE_LOGGING_LEVEL = 5
APPEND_LOG_FILE = 6
LOGFILE = 7
CONSOLE_LOGGING = 8
CONSOLE_LOGGING_LEVEL = 9
LOGGING_LEVEL_TYPES = ['NOTSET', 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL']

#Correlaction extracted from pyDicom
DICOM_ENCODING_TO_PYTHON = {
'None':'iso8859',
Expand Down
22 changes: 21 additions & 1 deletion invesalius/gui/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import invesalius.project as prj
import invesalius.session as ses
import invesalius.utils as utils
import invesalius.gui.log as log
import wx
import wx.aui
import wx.lib.popupctl as pc
Expand Down Expand Up @@ -136,6 +137,7 @@ def __init__(self, prnt):
self.__bind_events()
self.__bind_events_wx()

#log.initLogger()

def __bind_events(self):
"""
Expand Down Expand Up @@ -449,9 +451,13 @@ def ExitDialog(self):
save = dialog.IsCheckBoxChecked()
dialog.Destroy()

#logger = log.MyLogger()

if not save and answer == wx.ID_YES:
log.invLogger.closeLogging()
return 1 # Exit and delete session
elif save and answer == wx.ID_YES:
log.invLogger.closeLogging()
return 2 # Exit without deleting session
else:
return 0 # Don't Exit
Expand Down Expand Up @@ -674,6 +680,7 @@ def ShowPreferences(self, page=0):

if preferences_dialog.ShowModal() == wx.ID_OK:
values = preferences_dialog.GetPreferences()

preferences_dialog.Destroy()

session = ses.Session()
Expand All @@ -682,11 +689,23 @@ def ShowPreferences(self, page=0):
surface_interpolation = values[const.SURFACE_INTERPOLATION]
language = values[const.LANGUAGE]
slice_interpolation = values[const.SLICE_INTERPOLATION]

file_logging = values[const.FILE_LOGGING]
file_logging_level = values[const.FILE_LOGGING_LEVEL]
append_log_file = values[const.APPEND_LOG_FILE]
logging_file = values[const.LOGFILE]
console_logging = values[const.CONSOLE_LOGGING]
console_logging_level = values[const.CONSOLE_LOGGING_LEVEL]

session.SetConfig('rendering', rendering)
session.SetConfig('surface_interpolation', surface_interpolation)
session.SetConfig('language', language)
session.SetConfig('slice_interpolation', slice_interpolation)
session.SetConfig('file_logging', file_logging)
session.SetConfig('file_logging_level', file_logging_level)
session.SetConfig('append_log_file', append_log_file)
session.SetConfig('logging_file', logging_file)
session.SetConfig('console_logging', console_logging)
session.SetConfig('console_logging_level', console_logging_level)

Publisher.sendMessage('Remove Volume')
Publisher.sendMessage('Reset Raycasting')
Expand All @@ -695,6 +714,7 @@ def ShowPreferences(self, page=0):
Publisher.sendMessage('Update Navigation Mode MenuBar')
Publisher.sendMessage('Update Surface Interpolation')


def ShowAbout(self):
"""
Shows about dialog.
Expand Down
Loading

0 comments on commit 35d6551

Please sign in to comment.