mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
Debug: Add SqliteBrowser debug action.
This commit is contained in:
1 parent
9e0fb53b60
commit
ef398c78b1
1 file changed
+19
@@ -2,6 +2,7 @@
|
||||
|
||||
import os
|
||||
import logging
|
||||
import subprocess
|
||||
from queue import Queue
|
||||
|
||||
from PyQt5 import QtGui
|
||||
@@ -232,15 +233,22 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||
self.debug_action.setStatusTip("Debug")
|
||||
self.debug_action.triggered.connect(self.open_debug)
|
||||
|
||||
self.debug_sqlite_action = QAction("Debug SQLite", self)
|
||||
self.debug_sqlite_action.setStatusTip("Open SQLite debuging tool (sqlitebrowser)")
|
||||
self.debug_sqlite_action.triggered.connect(self.open_sqlite)
|
||||
|
||||
if self.conf.debug:
|
||||
menu.addAction(self.debug_action)
|
||||
menu.addAction(self.debug_sqlite_action)
|
||||
self.set_debug_lvl(debug = True)
|
||||
else:
|
||||
if self.conf.debug:
|
||||
menu.addAction(self.debug_action)
|
||||
menu.addAction(self.debug_sqlite_action)
|
||||
self.set_debug_lvl(debug = True)
|
||||
else:
|
||||
menu.removeAction(self.debug_action)
|
||||
menu.removeAction(self.debug_sqlite_action)
|
||||
self.set_debug_lvl(debug = False)
|
||||
|
||||
#########
|
||||
@@ -549,6 +557,17 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||
)
|
||||
repl.show()
|
||||
|
||||
def open_sqlite(self):
|
||||
if self.model is None:
|
||||
logger.debug("No study open for sql debuging...")
|
||||
return
|
||||
|
||||
file = self.model.filename
|
||||
_ = subprocess.Popen(
|
||||
f"sqlitebrowser {file}",
|
||||
shell=True
|
||||
)
|
||||
|
||||
# TODO: Delete me !
|
||||
###############
|
||||
# DUMMY STUFF #
|
||||
|
||||
Reference in new issue
Block a user