Files
sf/mainwindow.py
2022-01-10 13:18:29 +01:00

63 lines
2.7 KiB
Python

import inspect
import os
# Third-party modules
from qtpy.QtCore import (PYQT_VERSION_STR, Signal, Slot, QFile, QFileInfo,
QIODevice, QMutex, QSettings, QSize, Qt, QTimer,
qVersion)
from qtpy.QtCore import __version__ as QT_VERSION_STR
from qtpy.QtGui import (QColor, QKeySequence, QFont, QIcon, QPainter, QPalette,
QPixmap)
from qtpy.QtPrintSupport import QPrinter, QPrintDialog
from qtpy.QtWidgets import (QAbstractItemView, QAction, QActionGroup,
QApplication, QButtonGroup, QComboBox, QDialog,
QDockWidget, QDoubleSpinBox, QFileDialog, QFrame,
QGridLayout, QGroupBox, QHBoxLayout, QLabel,
QLayout, QLineEdit, QListWidget, QMainWindow, QMenu,
QMenuBar, QMessageBox, QPlainTextEdit, QProgressBar,
QPushButton, QScrollArea, QSizePolicy, QSlider,
QSpinBox, QSplashScreen, QStyle, QStyleOptionSlider,
QToolButton, QVBoxLayout, QWidget)
from pyqtacc.bdbase.base import BaseWindow
from pyqtacc.bdbase.enumkind import MsgSeverity, UserMode
from pyqtacc.bdbase.guiframe import GUIFrame
from pyqtacc.sf.guiheader import GUIHeader
_pymodule = os.path.basename(__file__)
_appversion = "1.0.0"
def _line():
"""Macro to return the current line number.
The current line number within the file is used when
reporting messages to the message logging window.
Returns:
int: Current line number.
"""
return inspect.currentframe().f_back.f_lineno
class MainWindow(BaseWindow):
def __init__(self, parent=None, pymodule=_pymodule, appversion="",
title="", user_mode=UserMode.OPERATION):
super(MainWindow, self).__init__(parent, pymodule, appversion, title)
self.appname, appext = pymodule.split(".")
self.title = title
self.gui_frame = GUIFrame(self, self.appname)
self.show_log_message = self.gui_frame.show_log_message
self.gui_header = GUIHeader(self, user_mode)
self.mainwindow = QWidget()
self.mainwindow_layout = QVBoxLayout()
#self.mainwindow_layout.addLayout(self.gui_header.top_layout)
self.mainwindow_layout.addWidget(self.gui_header.header_wgt)
self.mainwindow_layout.addWidget(self.gui_frame.central_tab_widget)
self.mainwindow.setLayout(self.mainwindow_layout)
self.mainwindow.setMinimumHeight(400)
self.mainwindow.setMinimumWidth(1100)
self.setCentralWidget(self.mainwindow)
self.show_log_message(MsgSeverity.INFO, _pymodule, _line(),
"Application started")