Skip to content

Commit

Permalink
open log folder instead of file itself
Browse files Browse the repository at this point in the history
makes copying and sharing the log file easier
  • Loading branch information
zocker-160 committed Dec 2, 2023
1 parent 72c29c7 commit 17ac41a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
10 changes: 5 additions & 5 deletions src/gui/Ui_mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,12 @@ def setupUi(self, MainWindow):
icon = QtGui.QIcon.fromTheme("view-refresh")
self.actionRestartService.setIcon(icon)
self.actionRestartService.setObjectName("actionRestartService")
self.actionOpenLogfile = QtWidgets.QAction(MainWindow)
self.actionOpenLogFolder = QtWidgets.QAction(MainWindow)
icon = QtGui.QIcon.fromTheme("text")
self.actionOpenLogfile.setIcon(icon)
self.actionOpenLogfile.setObjectName("actionOpenLogfile")
self.actionOpenLogFolder.setIcon(icon)
self.actionOpenLogFolder.setObjectName("actionOpenLogFolder")
self.menuFile.addAction(self.actionOpenConfigFolder)
self.menuFile.addAction(self.actionOpenLogfile)
self.menuFile.addAction(self.actionOpenLogFolder)
self.menuFile.addSeparator()
self.menuFile.addAction(self.actionRestartService)
self.menuFile.addSeparator()
Expand Down Expand Up @@ -298,5 +298,5 @@ def retranslateUi(self, MainWindow):
self.actionExit.setShortcut(_translate("MainWindow", "Ctrl+Q"))
self.actionRestartService.setText(_translate("MainWindow", "Force restart driver"))
self.actionRestartService.setToolTip(_translate("MainWindow", "check status of the background service"))
self.actionOpenLogfile.setText(_translate("MainWindow", "Open log file"))
self.actionOpenLogFolder.setText(_translate("MainWindow", "Open log folder"))
from gui.customwidgets import CListWidgetContent
6 changes: 3 additions & 3 deletions src/gui/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ QLabel#asd:pressed {
<string>File</string>
</property>
<addaction name="actionOpenConfigFolder"/>
<addaction name="actionOpenLogfile"/>
<addaction name="actionOpenLogFolder"/>
<addaction name="separator"/>
<addaction name="actionRestartService"/>
<addaction name="separator"/>
Expand Down Expand Up @@ -498,13 +498,13 @@ QLabel#asd:pressed {
<string>check status of the background service</string>
</property>
</action>
<action name="actionOpenLogfile">
<action name="actionOpenLogFolder">
<property name="icon">
<iconset theme="text">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="text">
<string>Open log file</string>
<string>Open log folder</string>
</property>
</action>
</widget>
Expand Down
10 changes: 7 additions & 3 deletions src/lib/configparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,17 @@ class Configparser:

@staticmethod
def getLogfile():
folder = os.path.join(
os.environ["HOME"], ".var", "log")
folder = Configparser.getLogFolder()
return os.path.join(folder, "keyboardCenter.log")

@staticmethod
def getLogFolder():
folder = os.path.join(os.environ["HOME"], ".var", "log")

if not os.path.isdir(folder):
os.makedirs(folder, exist_ok=True)

return os.path.join(folder, "keyboardCenter.log")
return folder

@staticmethod
def getPrivatePath(path: str):
Expand Down
6 changes: 3 additions & 3 deletions src/mainUi.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def setupUi(self):

def setupSlots(self):
self.actionOpenConfigFolder.triggered.connect(self.openConfigFolder)
self.actionOpenLogfile.triggered.connect(self.openLogfile)
self.actionOpenLogFolder.triggered.connect(self.openLogFolder)
self.actionRestartService.triggered.connect(self.forceRestart)
self.actionAbout_Qt.triggered.connect(self.app.aboutQt)
self.actionAbout.triggered.connect(self.showAbout)
Expand Down Expand Up @@ -379,8 +379,8 @@ def closeEvent(self, event: QCloseEvent):
def openConfigFolder(self):
openUrl(self.configparser.configFolder)

def openLogfile(self):
openUrl(Configparser.getLogfile())
def openLogFolder(self):
openUrl(Configparser.getLogFolder())

def showGitHub(self):
openUrl("https://github.com/zocker-160/keyboard-center")
Expand Down

0 comments on commit 17ac41a

Please sign in to comment.