Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions dosview/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from .version import __version__
from pyqtgraph import ImageView

from .calibration_widget import CalibrationTab
from .parsers import (
BaseLogParser,
Airdos04CLogParser,
Expand Down Expand Up @@ -1078,6 +1079,10 @@ def solve_startup_args(self):
print("Oteviram zalozku s labdosem")
self.openLabdosTab()

if self.args.calibration:
print("Oteviram zalozku s kalibraci")
self.openCalibrationTab()

def updateStackedWidget(self):
print("Updating stacked widget")
print(self.tab_widget.count())
Expand All @@ -1086,6 +1091,14 @@ def updateStackedWidget(self):
else:
self.stacked_container.setCurrentIndex(0)

def close_tab(self, index):
widget = self.tab_widget.widget(index)
if widget is None:
return
self.tab_widget.removeTab(index)
widget.deleteLater()
self.updateStackedWidget()

def openPlotTab(self, file_path = None):
plot_tab = PlotTab()
if not file_path:
Expand All @@ -1112,6 +1125,12 @@ def openLabdosTab(self):
self.tab_widget.setCurrentIndex(self.tab_widget.count() - 1)
self.updateStackedWidget()

def openCalibrationTab(self):
calibration_tab = CalibrationTab()
self.tab_widget.addTab(calibration_tab, "Calibration")
self.tab_widget.setCurrentIndex(self.tab_widget.count() - 1)
self.updateStackedWidget()

def blank_page(self):
# This is widget for blank page
# When no tab is opened
Expand All @@ -1134,6 +1153,7 @@ def initUI(self):

self.tab_widget.setCurrentIndex(0)
self.tab_widget.setTabsClosable(True)
self.tab_widget.tabCloseRequested.connect(self.close_tab)

bar = self.menuBar()
file = bar.addMenu("&File")
Expand All @@ -1159,6 +1179,10 @@ def initUI(self):
tools_labdosctrl.triggered.connect(self.action_switch_labdoscontrol)
tools.addAction(tools_labdosctrl)

tool_calibration = QAction("Calibration", self)
tool_calibration.triggered.connect(self.action_switch_calibration)
tools.addAction(tool_calibration)


help = bar.addMenu("&Help")
doc = QAction("Documentation", self)
Expand Down Expand Up @@ -1192,6 +1216,9 @@ def action_switch_airdoscontrol(self):
def action_switch_labdoscontrol(self):
self.openLabdosTab()

def action_switch_calibration(self):
self.openCalibrationTab()

import sys
import datetime
from PyQt5.QtCore import QT_VERSION_STR
Expand Down Expand Up @@ -1257,6 +1284,7 @@ def main():
parser.add_argument('file_path', type=str, help='Path to the input file', default=False, nargs='?')
parser.add_argument('--airdos', action='store_true', help='Enable airdos control tab')
parser.add_argument('--labdos', action='store_true', help='Enable labdos control tab')
parser.add_argument('--calibration', action='store_true', help='Enable calibration tab')
parser.add_argument('--no_gui', action='store_true', help='Disable GUI and run in headless mode')
parser.add_argument('--version', action='store_true', help='Print version and exit')
parser.add_argument('--new-window', action='store_true', help="Open file in new window")
Expand Down
Loading