-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
40 changed files
with
5,063 additions
and
352 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
repos: | ||
- repo: https://github.com/psf/black | ||
rev: 22.6.0 | ||
rev: 23.3.0 | ||
hooks: | ||
- id: black | ||
language_version: python3.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Packaging | ||
|
||
There are 2 available packaging formats: Installer or wheel. The former is what is distributed, while the latter is | ||
required for use of the CLI for instance. | ||
|
||
When packaging don't forget to check versions in both `setup.py` and `make_installer.iss` and ensure they match! | ||
|
||
### Installer | ||
|
||
**Currently, this is only supported on Windows.** | ||
|
||
The installer uses `PyInstaller` to extract all the dependencies and `InnoSetup` to create a Windows installer package | ||
out of them. | ||
|
||
1. Ensure you have installed `InnoSetup` [here](https://jrsoftware.org/isdl.php). | ||
|
||
2. Inside the root repository directory with the virtualenv active: | ||
|
||
```commandline | ||
python -O -m PyInstaller --noconfirm "pterasoftware.spec" | ||
``` | ||
|
||
We run `python` with the first level optimise flag `-O` to slim down some now unnecessary debug code. *Do not use second | ||
level optimisation `-OO`, as this removes some docstrings that break dependencies.* | ||
|
||
3. Open `make_installer.iss` in InnoSetup and run the packaging process. This can take a while, but should output an | ||
installer in the `Output` folder. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
"""This script opens the GUI to demonstrate Ptera Software analyzing example models. | ||
It is in development and will be able to run custom models in the future""" | ||
|
||
import os | ||
import sys | ||
import time | ||
import importlib | ||
|
||
print("Builtin modules imported") | ||
from PySide2.QtCore import Qt | ||
|
||
print("QTCore imported") | ||
from PySide2.QtGui import QPixmap | ||
|
||
print("QtGUI imported") | ||
from PySide2.QtWidgets import QMainWindow, QApplication, QSplashScreen, QDialog | ||
|
||
from pterasoftware.ui_resources.main_window import Ui_MainWindowDesign | ||
from pterasoftware.ui_resources.textdialog import Ui_TextAboutDialog | ||
|
||
|
||
class TextAboutDialog(QDialog): | ||
def __init__(self, title): | ||
super(TextAboutDialog, self).__init__() | ||
self.ui = Ui_TextAboutDialog() | ||
self.ui.setupUi(self) | ||
self.setWindowTitle(title) | ||
|
||
|
||
class MainWindow(QMainWindow, Ui_MainWindowDesign): | ||
def __init__(self): | ||
super(MainWindow, self).__init__() | ||
self.setupUi(self) | ||
|
||
self.actionExample_1.triggered.connect(lambda x: self.exampleMenu(0)) | ||
self.actionExample_2.triggered.connect(lambda x: self.exampleMenu(1)) | ||
self.actionExample_3.triggered.connect(lambda x: self.exampleMenu(2)) | ||
self.actionExample_4.triggered.connect(lambda x: self.exampleMenu(3)) | ||
self.actionExample_5.triggered.connect(lambda x: self.exampleMenu(4)) | ||
self.actionExample_6.triggered.connect(lambda x: self.exampleMenu(5)) | ||
self.actionExample_7.triggered.connect(lambda x: self.exampleMenu(6)) | ||
self.actionExample_8.triggered.connect(lambda x: self.exampleMenu(7)) | ||
self.actionExample_9.triggered.connect(lambda x: self.exampleMenu(8)) | ||
self.actionExample_10.triggered.connect(lambda x: self.exampleMenu(9)) | ||
|
||
self.actionAbout.triggered.connect(self.menuREADME) | ||
|
||
self.displayText = "" | ||
|
||
def exampleMenu(self, ex_num): | ||
|
||
files = [] | ||
for i, filename in enumerate(os.listdir("examples")): | ||
f = "examples." + filename | ||
files.append(f) | ||
file = files[ex_num] | ||
file = file.replace(".py", "") | ||
self.printTerminalOutput(f"Example {ex_num + 1} executed") | ||
print(file) | ||
importlib.import_module(file) | ||
|
||
def printTerminalOutput(self, text): | ||
print("Printing terminal output") | ||
self.terminalOutput.addItem(f"{text}") | ||
self.terminalOutput.scrollToBottom() | ||
|
||
def updateDisplayText(self, text): | ||
self.displayText = text | ||
self.printTerminalOutput(self, text) | ||
|
||
def menuREADME(self): | ||
from PySide2.QtGui import QTextDocument | ||
|
||
self.dialog = TextAboutDialog("About Ptera Software") | ||
doc = QTextDocument() | ||
doc.setMarkdown(self._read_file("README.md")) | ||
self.dialog.ui.textEdit.setDocument(doc) | ||
self.dialog.show() | ||
|
||
def _read_file(self, file_path: str) -> str: | ||
from PySide2.QtCore import QFile | ||
from PySide2.QtCore import QTextStream | ||
from PySide2.QtCore import QIODevice | ||
|
||
file = QFile(file_path) | ||
file.open(QIODevice.ReadOnly) | ||
ts = QTextStream(file) | ||
string = ts.readAll() | ||
return string | ||
|
||
|
||
if __name__ == "__main__": | ||
app = QApplication(sys.argv) | ||
pixmap = QPixmap("docs/logo.png") | ||
splash = QSplashScreen(pixmap) | ||
splash.setWindowFlags(Qt.WindowStaysOnTopHint) | ||
splash.setEnabled(False) | ||
splash.setMask(pixmap.mask()) | ||
splash.show() | ||
time.sleep(1) | ||
app.processEvents() | ||
|
||
window = MainWindow() | ||
window.show() | ||
window.raise_() | ||
window.activateWindow() | ||
splash.finish(window) | ||
sys.exit(app.exec_()) | ||
print("Exiting") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
; Script generated by the Inno Setup Script Wizard. | ||
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! | ||
|
||
#define MyAppName "PteraSoftware" | ||
#define MyAppVersion "3.0.0" | ||
#define MyAppPublisher "CamUrban" | ||
#define MyAppURL "https://github.com/camUrban/PteraSoftware" | ||
#define MyAppExeName "PteraSoftware.exe" | ||
#define MyAppAssocName MyAppName + " File" | ||
#define MyAppAssocExt ".myp" | ||
#define MyAppAssocKey StringChange(MyAppAssocName, " ", "") + MyAppAssocExt | ||
|
||
[Setup] | ||
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications. | ||
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) | ||
AppId={{F8405B7D-3F5B-4F81-BD8B-7C5D1F052165} | ||
AppName={#MyAppName} | ||
AppVersion={#MyAppVersion} | ||
;AppVerName={#MyAppName} {#MyAppVersion} | ||
AppPublisher={#MyAppPublisher} | ||
AppPublisherURL={#MyAppURL} | ||
AppSupportURL={#MyAppURL} | ||
AppUpdatesURL={#MyAppURL} | ||
DefaultDirName={autopf}\{#MyAppName} | ||
ChangesAssociations=yes | ||
DisableProgramGroupPage=yes | ||
LicenseFile=C:\Users\zacht\PycharmProjects\PteraSoftware\LICENSE.txt | ||
; Uncomment the following line to run in non administrative install mode (install for current user only.) | ||
;PrivilegesRequired=lowest | ||
OutputBaseFilename=PteraSoftware_installer | ||
Compression=lzma | ||
SolidCompression=yes | ||
WizardStyle=modern | ||
|
||
[Languages] | ||
Name: "english"; MessagesFile: "compiler:Default.isl" | ||
|
||
[Tasks] | ||
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked | ||
|
||
[Files] | ||
Source: "C:\Users\zacht\PycharmProjects\PteraSoftware\dist\main\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion | ||
Source: "C:\Users\zacht\PycharmProjects\PteraSoftware\dist\main\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs | ||
; NOTE: Don't use "Flags: ignoreversion" on any shared system files | ||
|
||
[Registry] | ||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue | ||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}"; ValueType: string; ValueName: ""; ValueData: "{#MyAppAssocName}"; Flags: uninsdeletekey | ||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppExeName},0" | ||
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""%1""" | ||
Root: HKA; Subkey: "Software\Classes\Applications\{#MyAppExeName}\SupportedTypes"; ValueType: string; ValueName: ".myp"; ValueData: "" | ||
|
||
[Icons] | ||
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" | ||
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon | ||
|
||
[Run] | ||
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent | ||
|
Oops, something went wrong.