Skip to content
Commits on Source (9)
......@@ -20,3 +20,4 @@ pip-wheel-metadata
.eggs/
exe/
installer/Output/
workspace.code-workspace
## [Unreleased]
### Miscellaneous
- Add VSCode workspace config to gitignore [a91fa73](https://gitlab.com/Earthnuker/ed_lrr/commit/a91fa73)
- formatting [f78ec66](https://gitlab.com/Earthnuker/ed_lrr/commit/f78ec66)
- **CI:** rename main executable before building installer [dc0e3fc](https://gitlab.com/Earthnuker/ed_lrr/commit/dc0e3fc)
## [v0.11.0] - 2019-09-28
### Features
- **GUI:** Integrate route computation Job [f4e6bd3](https://gitlab.com/Earthnuker/ed_lrr/commit/f4e6bd3)
## [v0.10.0] - 2019-09-28
### Features
- **GUI:** Integrate new config system [22ca2d2](https://gitlab.com/Earthnuker/ed_lrr/commit/22ca2d2)
### Miscellaneous
- re-export config from main GUI module [0d89106](https://gitlab.com/Earthnuker/ed_lrr/commit/0d89106)
## [v0.9.0] - 2019-09-28
### Features
- **cli:** Add config editor [8b0b56f](https://gitlab.com/Earthnuker/ed_lrr/commit/8b0b56f)
## [v0.8.0] - 2019-09-28
### Features
- **router:** Implement route computation job with progress dualog [2c000da](https://gitlab.com/Earthnuker/ed_lrr/commit/2c000da)
### Miscellaneous
- **setup.py:** Pull version info from git, unify scripts (one script for GUI and CLI) [a630851](https://gitlab.com/Earthnuker/ed_lrr/commit/a630851)
## [v0.7.0] - 2019-09-28
### Documentation
- Update README.md [66267e7](https://gitlab.com/Earthnuker/ed_lrr/commit/66267e7)
### Features
- **installer:** Download EDSM dumps after install [4237b30](https://gitlab.com/Earthnuker/ed_lrr/commit/4237b30)
### Miscellaneous
- Update icon generator and regenerate icon [7838480](https://gitlab.com/Earthnuker/ed_lrr/commit/7838480)
## [v0.6.0] - 2019-09-28
### Features
- **router:** Start implementing route pruning support [88a0378](https://gitlab.com/Earthnuker/ed_lrr/commit/88a0378)
## [v0.5.0] - 2019-09-28
### Features
- **config:** Update config system to use profig [b1143c3](https://gitlab.com/Earthnuker/ed_lrr/commit/b1143c3)
## [v0.4.0] - 2019-09-28
### Features
- **build system:** Remove build.py (switched to tox), add output to build_gui.py [fb3a130](https://gitlab.com/Earthnuker/ed_lrr/commit/fb3a130)
## [v0.3.0] - 2019-09-28
### Features
- **router:** Add dialog to display computed route [d498746](https://gitlab.com/Earthnuker/ed_lrr/commit/d498746)
## [v0.2.11] - 2019-09-21
### Bug Fixes
- switch inno setup version in appveyor [fe3534e](https://gitlab.com/Earthnuker/ed_lrr/commit/fe3534e)
## [v0.2.10] - 2019-09-21
### Bug Fixes
- typo in appveyor.yml [09e6f0a](https://gitlab.com/Earthnuker/ed_lrr/commit/09e6f0a)
## [v0.2.9] - 2019-09-21
### Bug Fixes
- disable confirmation for conda install [eaddb18](https://gitlab.com/Earthnuker/ed_lrr/commit/eaddb18)
## [v0.2.8] - 2019-09-21
### Bug Fixes
- add missing conda channel [6d9f1ef](https://gitlab.com/Earthnuker/ed_lrr/commit/6d9f1ef)
## [v0.2.7] - 2019-09-21
### Bug Fixes
- add missing dependencies to appveyor.yml [e8beb55](https://gitlab.com/Earthnuker/ed_lrr/commit/e8beb55)
## [v0.2.6] - 2019-09-20
### Bug Fixes
- fix nuikta call to clean build directory [fa485be](https://gitlab.com/Earthnuker/ed_lrr/commit/fa485be)
## [v0.2.5] - 2019-09-20
### Bug Fixes
- fix nuikta call to download without confirmation [11efe30](https://gitlab.com/Earthnuker/ed_lrr/commit/11efe30)
## [v0.2.4] - 2019-09-20
### Bug Fixes
- fixed appveyor.yml [59390fe](https://gitlab.com/Earthnuker/ed_lrr/commit/59390fe)
## [v0.2.3] - 2019-09-20
### Bug Fixes
- fixed tox.ini [6bb7e1e](https://gitlab.com/Earthnuker/ed_lrr/commit/6bb7e1e)
### Documentation
- small wording change [3779911](https://gitlab.com/Earthnuker/ed_lrr/commit/3779911)
## [v0.2.2] - 2019-08-31
### Bug Fixes
- **setup:** fix setup script to include subdirectories [4a392d9](https://gitlab.com/Earthnuker/ed_lrr/commit/4a392d9)
### Documentation
- Insert page break after table of contents [f027e02](https://gitlab.com/Earthnuker/ed_lrr/commit/f027e02)
- Update documentation to include basic description [714741a](https://gitlab.com/Earthnuker/ed_lrr/commit/714741a)
......@@ -28,7 +143,26 @@
## v0.0.0 - 2019-07-15
[Unreleased]: https://gitlab.com/Earthnuker/ed_lrr/compare/v0.2.1...HEAD
[Unreleased]: https://gitlab.com/Earthnuker/ed_lrr/compare/v0.11.0...HEAD
[v0.11.0]: https://gitlab.com/Earthnuker/ed_lrr/compare/v0.10.0...v0.11.0
[v0.10.0]: https://gitlab.com/Earthnuker/ed_lrr/compare/v0.9.0...v0.10.0
[v0.9.0]: https://gitlab.com/Earthnuker/ed_lrr/compare/v0.8.0...v0.9.0
[v0.8.0]: https://gitlab.com/Earthnuker/ed_lrr/compare/v0.7.0...v0.8.0
[v0.7.0]: https://gitlab.com/Earthnuker/ed_lrr/compare/v0.6.0...v0.7.0
[v0.6.0]: https://gitlab.com/Earthnuker/ed_lrr/compare/v0.5.0...v0.6.0
[v0.5.0]: https://gitlab.com/Earthnuker/ed_lrr/compare/v0.4.0...v0.5.0
[v0.4.0]: https://gitlab.com/Earthnuker/ed_lrr/compare/v0.3.0...v0.4.0
[v0.3.0]: https://gitlab.com/Earthnuker/ed_lrr/compare/v0.2.11...v0.3.0
[v0.2.11]: https://gitlab.com/Earthnuker/ed_lrr/compare/v0.2.10...v0.2.11
[v0.2.10]: https://gitlab.com/Earthnuker/ed_lrr/compare/v0.2.9...v0.2.10
[v0.2.9]: https://gitlab.com/Earthnuker/ed_lrr/compare/v0.2.8...v0.2.9
[v0.2.8]: https://gitlab.com/Earthnuker/ed_lrr/compare/v0.2.7...v0.2.8
[v0.2.7]: https://gitlab.com/Earthnuker/ed_lrr/compare/v0.2.6...v0.2.7
[v0.2.6]: https://gitlab.com/Earthnuker/ed_lrr/compare/v0.2.5...v0.2.6
[v0.2.5]: https://gitlab.com/Earthnuker/ed_lrr/compare/v0.2.4...v0.2.5
[v0.2.4]: https://gitlab.com/Earthnuker/ed_lrr/compare/v0.2.3...v0.2.4
[v0.2.3]: https://gitlab.com/Earthnuker/ed_lrr/compare/v0.2.2...v0.2.3
[v0.2.2]: https://gitlab.com/Earthnuker/ed_lrr/compare/v0.2.1...v0.2.2
[v0.2.1]: https://gitlab.com/Earthnuker/ed_lrr/compare/v0.2.0...v0.2.1
[v0.2.0]: https://gitlab.com/Earthnuker/ed_lrr/compare/v0.1.0...v0.2.0
[v0.1.0]: https://gitlab.com/Earthnuker/ed_lrr/compare/v0.0.0...v0.1.0
......@@ -2,3 +2,4 @@ from _ed_lrr import *
from .preprocess import Preprocessor
from .router import Router
from .config import cfg
from .main import main
\ No newline at end of file
from .main import main
......@@ -14,9 +14,9 @@ import ed_lrr_gui
import requests as RQ
from ed_lrr_gui import Preprocessor, Router, cfg
from ed_lrr_gui.gui.ed_lrr import Ui_ED_LRR
from ed_lrr_gui.gui.widget_route import Ui_Route
from ed_lrr_gui.gui.widget_route import Ui_diag_route
from PyQt5.QtCore import QObject, Qt, QThread, QTimer, pyqtSignal
from PyQt5.QtGui import QColor, QPalette,QIcon
from PyQt5.QtGui import QColor, QPalette, QIcon
from PyQt5.QtWidgets import (
QAction,
QApplication,
......@@ -79,14 +79,20 @@ class Job(QObject):
return self.job.start()
def cancel(self):
self.job.terminate()
self.job.terminate()
self.job = None
def __bool__(self):
return not self.done
@property
def done(self):
if self.job:
return (self.job.is_alive() == False) and (self.job.queue.empty())
return True
def interval(self):
while self.job:
while self:
try:
res = self.job.queue.get(True, 0.1)
except queue.Empty:
......@@ -103,20 +109,16 @@ class RouterJob(Job):
super().__init__(app, main_window, Router, *args, **kwargs)
self.progress_dialog = ProgressDialog("", "Cancel", 0, 0, self.main_window)
self.progress_dialog.setAutoClose(False)
self.progress_dialog.setLabelText("Loading...")
self.progress_dialog.setLabelText("Loading (this will take a bit) ...")
self.progress_dialog.setWindowTitle("Loading...")
self.progress_dialog.canceled.connect(self.cancel)
self.progress_dialog.show()
self.start()
def done(self,result):
return
def handle_progess(self, state):
if state.get('return') is not None:
self.done(state['return'])
self.progress_dialog.close()
WRoute(state['return'])
route_win=WRoute(self.main_window,state['return'])
return
msg = "Depth: {depth}\nBody: {body}\nQueued: {queue_size}\nDistance remaining: {d_rem:.2f} Ly".format(
**state["status"]
......@@ -212,6 +214,17 @@ class App(QApplication):
self.styles[style] = palette
self.styles["Light"] = self.style().standardPalette()
class WRoute(Ui_diag_route):
def __init__(self,main_window,hops):
super().__init__()
dialog=QDialog(main_window)
self.setupUi(dialog)
for n,item in enumerate(hops):
if item['body'].startswith(item['system']):
item['body']=item['body'].replace(item['system'],"").strip()
item = QTreeWidgetItem(self.lst_route, [str(n+1),item['system'],"{body} ({star_type})".format(**item),str(item['distance']), None])
item.setFlags(item.flags() & ~Qt.ItemIsDropEnabled)
dialog.exec_()
class ED_LRR(Ui_ED_LRR):
dl_thread = None
......@@ -221,23 +234,13 @@ class ED_LRR(Ui_ED_LRR):
def __init__(self):
super().__init__()
self.config = cfg.load()
self.jobs = {}
def new_job(self, cls, *args, **kwargs):
print("CREATE JOB:", cls, args, kwargs)
name = cls.__name__
if name in self.jobs and self.jobs[name].done():
del self.jobs[name]
if not name in self.jobs:
self.jobs[name] = Job(self.app, self.main_window, cls, *args, **kwargs)
return self.jobs[name]
self.current_job = None
def get_open_file(self, filetypes, callback=None):
fileName, _ = QFileDialog.getOpenFileName(
self.main_window,
"Open file",
str(cfg.data_dir),
cfg["folders.data_dir"],
filetypes,
options=QFileDialog.DontUseNativeDialog,
)
......@@ -249,7 +252,7 @@ class ED_LRR(Ui_ED_LRR):
fileName, _ = QFileDialog.getSaveFileName(
self.main_window,
"Save file",
str(cfg.data_dir),
cfg["folders.data_dir"],
filetypes,
options=QFileDialog.DontUseNativeDialog,
)
......@@ -258,21 +261,21 @@ class ED_LRR(Ui_ED_LRR):
return fileName
def set_sys_lst(self, path):
if path not in self.config.history_out_path:
self.config.history_out_path.append(path)
if path not in cfg["history.out_path"]:
cfg["history.out_path"].append(path)
self.inp_sys_lst.addItem(path)
self.inp_out_pp.addItem(path)
self.inp_sys_lst.setCurrentText(path)
self.inp_out_pp.setCurrentText(path)
def set_bodies_file(self, path):
if path not in self.config.history_bodies_path:
self.config.history_bodies_path.append(path)
if path not in cfg["history.bodies_path"]:
cfg["history.bodies_path"].append(path)
self.inp_bodies_pp.addItem(path)
def set_systems_file(self, path):
if path not in self.config.history_systems_path:
self.config.history_systems_path.append(path)
if path not in cfg["history.systems_path"]:
cfg["history.systems_path"].append(path)
self.inp_systems_pp.addItem(path)
def update_dropdowns(self):
......@@ -344,17 +347,19 @@ class ED_LRR(Ui_ED_LRR):
return
return path
def route_progress(self, job, state):
print("RP:", job, state)
def compute_route(self):
self.bar_status.showMessage("Resolving systems...")
num_resolved=self.resolve_systems()
if num_resolved:
if QMessageBox.question(self.main_window,"ED_LRR","Resolved {} systems, are the names correct?".format(num_resolved))==QMessageBox.No:
return
if QMessageBox.question(self.main_window,"ED_LRR","Resolved {} system(s), are the names correct?".format(num_resolved))==QMessageBox.No:
return
self.bar_status.clearMessage()
print(self.systems)
systems = [str(s["id"]) for s in self.systems]
jump_range = self.sb_range.value()
if jump_range==0:
self.error("Your jump range is set to zero, you're not going to get anywhere that way")
return
mode = self.cmb_mode.currentText()
primary = self.chk_primary.isChecked()
keep_first = self.chk_permute_keep_first.isChecked()
......@@ -386,31 +391,25 @@ class ED_LRR(Ui_ED_LRR):
path,
precomp,
)
if self.current_job is None:
if not self.current_job:
self.bar_status.showMessage("Computing Route...")
self.current_job = RouterJob(
self.app,
self.main_window,
systems,
jump_range,
systems,
jump_range,
None,
mode,
primary,
permute,
keep_first,
keep_last,
greedyness,
precomp,
path,
)
if route_job:
self.route_progress_dialog = ProgressDialog(
"Computing route...", "Cancel", 0, 100, self.main_window
mode,
primary,
permute,
keep_first,
keep_last,
greedyness,
precomp,
path,
)
self.route_progress_dialog.canceled.connect(route_job.cancel)
route_job.start()
self.route_progress_dialog.show()
else:
self.error("Another route job is already running!")
self.error("there is already a job running!")
def find_sys_by_names(self, names):
t_s = datetime.today()
......@@ -552,7 +551,7 @@ class ED_LRR(Ui_ED_LRR):
)
def handle_close(self):
cfg.write(self.config)
cfg.sync()
print("BYEEEEEE!")
def setup_styles(self, win, app):
......@@ -578,9 +577,9 @@ class ED_LRR(Ui_ED_LRR):
def main():
MP.freeze_support()
app = App()
app.setWindowIcon(QIcon(r'D:\devel\rust\ed_lrr_gui\icon\icon.ico'))
app.setWindowIcon(QIcon(r"D:\devel\rust\ed_lrr_gui\icon\icon.ico"))
MainWindow = QMainWindow()
MainWindow.setWindowIcon(QIcon(r'D:\devel\rust\ed_lrr_gui\icon\icon.ico'))
MainWindow.setWindowIcon(QIcon(r"D:\devel\rust\ed_lrr_gui\icon\icon.ico"))
ui = ED_LRR()
ui.setupUi(MainWindow, app)
MainWindow.show()
......
......@@ -10,16 +10,16 @@
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.setWindowModality(QtCore.Qt.WindowModal)
Dialog.resize(430, 300)
self.layout_main = QtWidgets.QGridLayout(Dialog)
class Ui_diag_route(object):
def setupUi(self, diag_route):
diag_route.setObjectName("diag_route")
diag_route.setWindowModality(QtCore.Qt.WindowModal)
diag_route.resize(430, 300)
self.layout_main = QtWidgets.QGridLayout(diag_route)
self.layout_main.setObjectName("layout_main")
self.layout_top = QtWidgets.QGridLayout()
self.layout_top.setObjectName("layout_top")
self.lst_route = QtWidgets.QTreeWidget(Dialog)
self.lst_route = QtWidgets.QTreeWidget(diag_route)
self.lst_route.setProperty("showDropIndicator", False)
self.lst_route.setDefaultDropAction(QtCore.Qt.IgnoreAction)
self.lst_route.setAlternatingRowColors(True)
......@@ -33,23 +33,27 @@ class Ui_Dialog(object):
self.layout_main.addLayout(self.layout_top, 0, 0, 1, 1)
self.layout_bottom = QtWidgets.QGridLayout()
self.layout_bottom.setObjectName("layout_bottom")
self.chk_copy = QtWidgets.QCheckBox(Dialog)
self.chk_copy = QtWidgets.QCheckBox(diag_route)
self.chk_copy.setObjectName("chk_copy")
self.layout_bottom.addWidget(self.chk_copy, 1, 0, 1, 1)
self.pushButton = QtWidgets.QPushButton(Dialog)
self.pushButton.setObjectName("pushButton")
self.layout_bottom.addWidget(self.pushButton, 1, 1, 1, 1)
self.btn_close = QtWidgets.QPushButton(diag_route)
self.btn_close.setObjectName("btn_close")
self.layout_bottom.addWidget(self.btn_close, 1, 2, 1, 1)
self.btn_export = QtWidgets.QPushButton(diag_route)
self.btn_export.setObjectName("btn_export")
self.layout_bottom.addWidget(self.btn_export, 1, 1, 1, 1)
self.layout_main.addLayout(self.layout_bottom, 1, 0, 1, 1)
self.retranslateUi(Dialog)
QtCore.QMetaObject.connectSlotsByName(Dialog)
self.retranslateUi(diag_route)
QtCore.QMetaObject.connectSlotsByName(diag_route)
def retranslateUi(self, Dialog):
def retranslateUi(self, diag_route):
_translate = QtCore.QCoreApplication.translate
Dialog.setWindowTitle(_translate("Dialog", "Route"))
self.lst_route.headerItem().setText(0, _translate("Dialog", "Num"))
self.lst_route.headerItem().setText(1, _translate("Dialog", "System"))
self.lst_route.headerItem().setText(2, _translate("Dialog", "Body"))
self.lst_route.headerItem().setText(3, _translate("Dialog", "Distance (Ls)"))
self.chk_copy.setText(_translate("Dialog", "Auto-copy next hop to clipboard"))
self.pushButton.setText(_translate("Dialog", "Close"))
diag_route.setWindowTitle(_translate("diag_route", "Route"))
self.lst_route.headerItem().setText(0, _translate("diag_route", "Num"))
self.lst_route.headerItem().setText(1, _translate("diag_route", "System"))
self.lst_route.headerItem().setText(2, _translate("diag_route", "Body"))
self.lst_route.headerItem().setText(3, _translate("diag_route", "Distance (Ls)"))
self.chk_copy.setText(_translate("diag_route", "Auto-copy next hop to clipboard"))
self.btn_close.setText(_translate("diag_route", "Close"))
self.btn_export.setText(_translate("diag_route", "Export"))
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<class>diag_route</class>
<widget class="QDialog" name="diag_route">
<property name="windowModality">
<enum>Qt::WindowModal</enum>
</property>
......@@ -78,13 +78,20 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="pushButton">
<item row="1" column="2">
<widget class="QPushButton" name="btn_close">
<property name="text">
<string>Close</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="btn_export">
<property name="text">
<string>Export</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
......
......@@ -489,7 +489,7 @@ impl Router {
&start_sys,
));
seen.insert(start_sys.id);
while !(queue.is_empty() || found) {
while !found {
while let Some((depth, _, sys)) = queue.pop() {
if t_last.elapsed().as_millis() > 100 {
t_last = Instant::now();
......@@ -534,6 +534,9 @@ impl Router {
});
// queue.reverse();
}
if queue.is_empty() {
break;
}
}
println!();
......@@ -590,7 +593,7 @@ impl Router {
let mut queue: Vec<(f32, usize, &System)> = Vec::new();
queue.push((start_sys.distp(goal_sys), 0, &start_sys));
seen.insert(start_sys.id);
while !(queue.is_empty() || found) {
while !found {
while let Some((_, depth, sys)) = queue.pop() {
if t_last.elapsed().as_millis() > 100 {
t_last = Instant::now();
......@@ -629,6 +632,9 @@ impl Router {
queue.sort_by(|a, b| fcmp(a.0, b.0).then(a.1.cmp(&b.1)));
queue.reverse();
}
if queue.is_empty() {
break;
}
}
if !found {
return Err(format!("No route from {} to {} found!", src_name, dst_name));
......@@ -820,7 +826,7 @@ impl Router {
let mut queue_next: VecDeque<(usize, &System)> = VecDeque::new();
queue.push_front((0, &start_sys));
seen.insert(start_sys.id);
while !(queue.is_empty() || found) {
while !found {
while let Some((d, sys)) = queue.pop_front() {
if sys.id == goal_sys.id {
found = true;
......@@ -877,6 +883,9 @@ impl Router {
);
}
std::mem::swap(&mut queue, &mut queue_next);
if queue.is_empty() {
break;
}
depth += 1;
}
println!();
......
......@@ -6,6 +6,7 @@ requires = tox-conda
description = Build ED_LRR
recreate = True
skip_install = True
skipsdist = True
deps =
PyQt5
setuptools_rust
......@@ -22,6 +23,7 @@ passenv =
whitelist_externals =
cargo
iscc
cmd
conda_channels =
conda-forge
extras =
......@@ -30,6 +32,5 @@ commands =
python build_gui.py
pip install .[dev]
python -m nuitka --plugin-enable=multiprocessing --remove-output --plugin-enable=qt-plugins --standalone --assume-yes-for-downloads --follow-imports --output-dir=exe ed_lrr_gui\__main__.py
rename exe\__main__.dist\__main__.exe ED_LRR.exe
cd installer
iscc /QP ED_LRR.iss
\ No newline at end of file
cmd /c rename exe\__main__.dist\__main__.exe ED_LRR.exe
iscc /QP installer/ED_LRR.iss
\ No newline at end of file