Commit e149a9a3 authored by AJ Fite's avatar AJ Fite 🛫

All currently planned UI elements sorta working

parent 2164da79
......@@ -3,7 +3,7 @@
<class>aboutDialog</class>
<widget class="QDialog" name="aboutDialog">
<property name="windowModality">
<enum>Qt::NonModal</enum>
<enum>Qt::ApplicationModal</enum>
</property>
<property name="geometry">
<rect>
......@@ -34,6 +34,9 @@
<property name="windowTitle">
<string>About SIMF</string>
</property>
<property name="modal">
<bool>true</bool>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
......
......@@ -152,14 +152,14 @@
<property name="title">
<string>Fi&amp;le</string>
</property>
<addaction name="actionCapture_Settings"/>
<addaction name="actionSettings"/>
<addaction name="actionExit"/>
</widget>
<widget class="QMenu" name="menuFile">
<property name="title">
<string>Abo&amp;ut</string>
</property>
<addaction name="actionSource_Code"/>
<addaction name="actionSourceCode"/>
<addaction name="actionLicense"/>
<addaction name="actionAbout"/>
</widget>
......@@ -167,17 +167,23 @@
<addaction name="menuFile"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<action name="actionCapture_Settings">
<action name="actionSettings">
<property name="text">
<string>&amp;Capture Settings</string>
</property>
<property name="iconText">
<string>Settings</string>
</property>
<property name="toolTip">
<string>Settings</string>
</property>
</action>
<action name="actionExit">
<property name="text">
<string>&amp;Exit</string>
</property>
</action>
<action name="actionSource_Code">
<action name="actionSourceCode">
<property name="text">
<string>&amp;Source Code</string>
</property>
......
from PyQt5 import uic
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QDialog
class AboutDialog(QDialog):
def __init__(self):
super().__init__(flags=Qt.WindowStaysOnTopHint)
uic.loadUi('AboutDialog.ui', self)
self.show()
#!/usr/bin/env python
import os
import sys
import webbrowser
from PyQt5 import uic
from PyQt5.QtCore import QProcess, QProcessEnvironment, Qt
from PyQt5.QtWidgets import QMainWindow, QApplication
from watchdog.observers import Observer
import filehandlers, sudo
from config import Config
from about import AboutDialog
from config import Config, ConfigEditor
class MainWindow(QMainWindow):
......@@ -19,16 +21,47 @@ class MainWindow(QMainWindow):
self.show()
self.passprompt = None
self.configdialog = None
self.aboutdialog = None
# Register Events
self.startCapButton.clicked.connect(self.start_capture)
self.stopCapButton.clicked.connect(self.stop_capture)
self.actionSourceCode.triggered.connect(
lambda:
MainWindow.open_link("https://git.nclf.net/SIMF/simf-python-gui")
)
self.actionLicense.triggered.connect(
lambda:
MainWindow.open_link("https://git.nclf.net/SIMF/simf-python-gui/"
"blob/master/LICENSE.md")
)
self.actionExit.triggered.connect(self.close)
self.actionSettings.triggered.connect(self.show_settings)
self.actionAbout.triggered.connect(self.show_about)
# Process setup
self.simfProcess.readyRead.connect(self.console_write)
self.simfProcess.started.connect(self.process_started)
self.simfProcess.finished.connect(self.process_finished)
# Opens a link
@staticmethod
def open_link(link):
webbrowser.open(link)
# Triggered when window closes, I know it isn't PEP8 compliant but thats
# the way pyqt5 is
def closeEvent(self, QCloseEvent):
self.simfProcess.kill()
self.close()
def show_about(self):
self.aboutdialog = AboutDialog()
def show_settings(self):
self.configdialog = ConfigEditor()
def process_started(self):
self.startCapButton.setDisabled(True)
self.stopCapButton.setEnabled(True)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment