Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ツールバーにアイコンを設置する #38

Merged
merged 1 commit into from
Jul 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions plateau_plugin/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

from processing import execAlgorithmDialog
from PyQt5.QtWidgets import QAction
from qgis.core import QgsApplication
from qgis.gui import QgisInterface

Expand All @@ -32,5 +34,16 @@ def initGui(self):
self.provider = PlateauProcessingProvider()
QgsApplication.processingRegistry().addProvider(self.provider)

icon = self.provider.icon()
self._toolbar_action = QAction(
icon, "PLATEAU 3D都市モデルを読み込む", self.iface.mainWindow()
)
self._toolbar_action.triggered.connect(self._show_processing_dialog)
self.iface.addToolBarIcon(self._toolbar_action)

def _show_processing_dialog(self):
execAlgorithmDialog("plateau_plugin:load_as_vector", {})

def unload(self):
self.iface.removeToolBarIcon(self._toolbar_action)
QgsApplication.processingRegistry().removeProvider(self.provider)
Loading