Skip to content

Commit

Permalink
Merge pull request #126 from MIERUNE/feat/ui-run-protocol
Browse files Browse the repository at this point in the history
Implement new way of start process
  • Loading branch information
Kanahiro authored Aug 10, 2023
2 parents f1f8bcf + 763d1b0 commit bbf7aa0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
20 changes: 10 additions & 10 deletions ui/main_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import sip
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QDialog, QMessageBox, QTreeWidgetItem
from PyQt5.QtWidgets import QDialog, QMessageBox, QTreeWidgetItem, QFileDialog
from qgis.PyQt.QtGui import QIcon
from qgis.core import (
QgsMapLayerModel,
Expand Down Expand Up @@ -58,18 +58,18 @@ def init_ui(self):
self.process_node
)

def _get_excution_params(self):
def _run(self):
layers = self._get_checked_layers()

output_dir = QFileDialog.getExistingDirectory(self, "Select Folder")
if output_dir == "":
return

params = {
"extent": self.ui.mExtentGroupBox.outputExtent(),
"output_dir": self.ui.outputFileWidget.filePath(),
"output_dir": output_dir,
}

return params

def _run(self):
layers = self._get_checked_layers()
params = self._get_excution_params()

# generate label vector includes labels of all layers
all_labels = generate_label_vector(params["extent"])

Expand Down Expand Up @@ -144,7 +144,7 @@ def _run(self):
}
write_json(
project_json,
os.path.join(self.ui.outputFileWidget.filePath(), "project.json"),
os.path.join(params["output_dir"], "project.json"),
)

# messaging
Expand Down
9 changes: 1 addition & 8 deletions ui/main_dialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,12 @@
<item>
<widget class="QgsExtentGroupBox" name="mExtentGroupBox"/>
</item>
<item>
<widget class="QgsFileWidget" name="outputFileWidget">
<property name="storageMode">
<enum>QgsFileWidget::GetDirectory</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="pushButton_run">
<property name="text">
<string>処理開始</string>
<string>出力フォルダーを選択して実行</string>
</property>
</widget>
</item>
Expand Down

0 comments on commit bbf7aa0

Please sign in to comment.