68 lines
2.4 KiB
Python
68 lines
2.4 KiB
Python
import inspect
|
|
import platform
|
|
import os
|
|
import time
|
|
|
|
# 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, QTemporaryDir
|
|
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)
|
|
|
|
import pyqtacc.bdbase.pyrcc5.qrc_resources
|
|
from pyqtacc.bdbase.enumkind import MsgSeverity, UsageMode
|
|
from pyqtacc.bdbase.readjson import ReadJSON
|
|
|
|
import PyCafe
|
|
|
|
_pymodule = os.path.basename(__file__)
|
|
_appname, _appext = _pymodule.split(".")
|
|
_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 MenuBar(QMainWindow):
|
|
""" MenuBar
|
|
"""
|
|
def __init__(self, parent=None, pymodule=None, appversion=None, title=""):
|
|
super(MenuBar, self).__init__(parent)
|
|
pass
|
|
|
|
def create_action(self, text, slot=None, shortcut=None, icon=None, tip=None,
|
|
checkable=False, signal="triggered()"):
|
|
action = QAction(text, self)
|
|
if icon is not None:
|
|
action.setIcon(QIcon(":/{0}.png".format(icon)))
|
|
if shortcut is not None:
|
|
action.setShortcut(shortcut)
|
|
if tip is not None:
|
|
action.setToolTip(tip)
|
|
if slot is not None:
|
|
action.triggered.connect(slot)
|
|
if checkable:
|
|
action.setCheckable(True)
|
|
return action
|