Path: blob/main/tools/contributed/sumopy/agilepy/lib_wx/modulegui.py
169689 views
# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo1# Copyright (C) 2016-2025 German Aerospace Center (DLR) and others.2# SUMOPy module3# Copyright (C) 2012-2021 University of Bologna - DICAM4# This program and the accompanying materials are made available under the5# terms of the Eclipse Public License 2.0 which is available at6# https://www.eclipse.org/legal/epl-2.0/7# This Source Code may also be made available under the following Secondary8# Licenses when the conditions for such availability set forth in the Eclipse9# Public License 2.0 are satisfied: GNU General Public License, version 210# or later which is available at11# https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html12# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later1314# @file modulegui.py15# @author Joerg Schweizer16# @date 20121718import os19import wx2021import agilepy.lib_base.classman as cm22from agilepy import AGILEDIR232425def get_agileicon(name):26return wx.Bitmap(os.path.join(AGILEDIR, 'lib_wx', 'images', name))272829class ModuleGui:30"""Manages all GUIs to interact between the widgets from mainframe31and the specific functions of the module.32"""3334def __init__(self, ident):3536self._init_common(ident,37module=cm.BaseObjman('empty'),38priority=9999999,39icondirpath=os.path.join(os.path.dirname(__file__), 'images')40)41# self._init_constants()4243# def _init_constants(self):44# self._is_needs_refresh = False4546def get_initpriority(self):47return self._initpriority4849def _init_common(self, ident, module=None, priority=9999999, icondirpath=''):50"""51ident: any string to identify this gui52module: the module which interacts with this gui53priority: specifies priority with wich this gui initialized in mainframe54Initialization of widgets in init_widgets55"""5657self._ident = ident58self._set_module(module)59self._initpriority = priority60self._icondirpath = icondirpath61self._is_needs_refresh = False6263def get_icon(self, name):64return wx.Bitmap(os.path.join(self._icondirpath, name))6566def get_agileicon(self, name):67return wx.Bitmap(os.path.join(AGILEDIR, 'lib_wx', 'images', name))6869def _set_module(self, module):70self._module = module7172def get_module(self):73return self._module7475def get_ident(self):76return self._ident7778def get_logger(self):79return self._mainframe.get_logger()8081# def set_logger(self, logger):82# self._logger = logger8384def init_widgets(self, mainframe):85"""86Set mainframe and initialize widgets to various places.87"""88self._mainframe = mainframe89self.make_menu()90self.make_toolbar()9192def refresh_widgets(self):93"""94Check through mainframe what the state of the application is95and reset widgets. For exampe enable/disable widgets96dependent on the availability of data.97"""98pass99100def make_toolbar(self):101pass102103def make_menu(self):104pass105106def on_browse_obj(self, event=None):107self._mainframe.browse_obj(self.get_module())108109110