This commit is contained in:
2021-10-29 16:52:33 +02:00
parent 86b70f43ac
commit c33fd9b2b7
2 changed files with 4 additions and 18 deletions

View File

@@ -8,7 +8,7 @@ class AboutDialog(QDialog):
def __init__(self, parent=None): def __init__(self, parent=None):
super(AboutDialog, self).__init__(parent) super(AboutDialog, self).__init__(parent)
self.setWindowTitle(self.tr("About")) self.setWindowTitle(self.tr("About RavenLog"))
self.setModal(True) self.setModal(True)
self.layout = QVBoxLayout(self) self.layout = QVBoxLayout(self)

20
main.py
View File

@@ -11,7 +11,6 @@ import sys
import urlutils import urlutils
from aboutdialog import AboutDialog from aboutdialog import AboutDialog
from ravenui import RavenUI from ravenui import RavenUI
from settings import Settings
from settingsstore import SettingsStore from settingsstore import SettingsStore
from tabs import Tabs from tabs import Tabs
from urlutils import url_is_file from urlutils import url_is_file
@@ -38,20 +37,12 @@ class MainWindow(QMainWindow):
self.tabs.create_tab("/home/andi/ws/ravenlog/example.log") self.tabs.create_tab("/home/andi/ws/ravenlog/example.log")
self.tabs.create_tab("/var/log/syslog") self.tabs.create_tab("/var/log/syslog")
self._menu_recent_files = QMenu(self.tr("Open &Recent"), self)
self.setCentralWidget(self.tabs) self.setCentralWidget(self.tabs)
# self.main_tool_bar = self.create_main_tool_bar()
# self.addToolBar(self.main_tool_bar)
self.setStatusBar(QStatusBar(self)) self.setStatusBar(QStatusBar(self))
self.setMenuBar(self.create_menu_bar()) self.setMenuBar(self.create_menu_bar())
def create_main_tool_bar(self):
result = QToolBar("main toolbar")
return result
def update_font_size(self, font_size):
self.settings.font_size(int(font_size))
self.tabs.update()
def create_menu_bar(self) -> QMenuBar: def create_menu_bar(self) -> QMenuBar:
menu_bar = QMenuBar() menu_bar = QMenuBar()
@@ -69,7 +60,6 @@ class MainWindow(QMainWindow):
close_action = QAction(self.tr("E&xit", "menu item to close the application"), self) close_action = QAction(self.tr("E&xit", "menu item to close the application"), self)
close_action.triggered.connect(self.destruct) close_action.triggered.connect(self.destruct)
self._menu_recent_files = QMenu(self.tr("Open &Recent"), self)
self._update_recent_files_menu() self._update_recent_files_menu()
file_menu.addAction(open_file) file_menu.addAction(open_file)
@@ -81,7 +71,7 @@ class MainWindow(QMainWindow):
help_menu = QMenu(self.tr("&Help", "name of the help menu"), self) help_menu = QMenu(self.tr("&Help", "name of the help menu"), self)
about_action = QAction(self.tr("&About"), self) about_action = QAction(self.tr("&About"), self)
about_action.triggered.connect(self._open_about_dialog) about_action.triggered.connect(lambda: AboutDialog().exec())
help_menu.addAction(about_action) help_menu.addAction(about_action)
return help_menu return help_menu
@@ -94,10 +84,6 @@ class MainWindow(QMainWindow):
action.triggered.connect(lambda x, f=file: self._open_file(f)) action.triggered.connect(lambda x, f=file: self._open_file(f))
self._menu_recent_files.addAction(action) self._menu_recent_files.addAction(action)
def _open_about_dialog(self):
dialog = AboutDialog()
dialog.exec()
def _open_file_dialog(self) -> None: def _open_file_dialog(self) -> None:
current_file = self.tabs.current_file() current_file = self.tabs.current_file()
directory = os.path.dirname(current_file) if current_file else '' directory = os.path.dirname(current_file) if current_file else ''