当前位置: 首页>>代码示例>>Python>>正文


Python Controller.instance方法代码示例

本文整理汇总了Python中Controller.Controller.instance方法的典型用法代码示例。如果您正苦于以下问题:Python Controller.instance方法的具体用法?Python Controller.instance怎么用?Python Controller.instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Controller.Controller的用法示例。


在下文中一共展示了Controller.instance方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from Controller import Controller [as 别名]
# 或者: from Controller.Controller import instance [as 别名]
 def __init__( self, parent=None, userOnly=True):
     QWidget.__init__( self, parent)
     self._controller = Controller.instance()
     self._database = self._controller.database()
     self.setupUi( self )
     self._group = None
     self._loadCodeOnSelect = True
     self.populateSystemCodes(userOnly)
     adaptor = SqlAlchemyAdaptor( SystemCode )
     model = ListModelConnector( adaptor=adaptor, columns=['code','category','value','description'], idColumn='code')
     self.uCodesTable.setModel( model )
     
     self.uCodeEditor.setAdaptor( adaptor, 'code_', 'system code')
     self.uCodeEditor.addValidator('code', UCaseRegExpValidator(r'\w{4}'), 'The code must be a four character string' )
     self.uCodeEditor.addValidator('code', self.checkCodeIsUnique, 'Invalid code: The code entered is already defined')
     self.uCodeEditor.addValidator('value', r'\S.*', 'The value cannot be empty')
     self.uCodeEditor.loaded.connect( self.codeLoaded )
     self.uCodeEditor.saved.connect( self.codeSaved )
     self.uCodeEditor.cancelled.connect( self.codeCancelled )
     
     self.uCodeGroupSelector.currentIndexChanged[int].connect(lambda x: self.selectCodeGroup())
     self.uCodesTable.rowSelected.connect(self.codeSelected)
     self.uDeleteCodeButton.clicked.connect(self.deleteCode)
     self.uNewCodeButton.clicked.connect(self.newCode)
     self.uCodeGroupSelector.setCurrentIndex(0)
开发者ID:iharrison,项目名称:gazetteer,代码行数:27,代码来源:SystemCodeEditorWidget.py

示例2: __init__

# 需要导入模块: from Controller import Controller [as 别名]
# 或者: from Controller.Controller import instance [as 别名]
 def __init__( self, parent=None, userOnly=True):
     QWidget.__init__( self, parent)
     self.setupUi( self )
     self._setAdvanced(False)
     self._searchDef=None
     self._mapExtents=None
     self._keyState=Qt.NoModifier
     self._controller = Controller.instance()
     self._applyMapExtents()
     self._adaptor = DictionaryAdaptor( 'name','name_status','feat_type')
     self.uSearchResults.setTabKeyNavigation(False)
     self._populateDropDownLists()
     self.uSearchText.installEventFilter( self )
     self.uSearchResults.installEventFilter( self )
     self.uToggleAdvanced.clicked.connect( lambda: self._setAdvanced( not self._advanced ) )
     self.uSearchButton.clicked.connect( self._doSearch )
     self.uClearSearch.clicked.connect( lambda: self._doSearch(True) )
     self.uSearchResults.clicked.connect( lambda i: self._selectResult(self.uSearchResults,i) )
     self.uRecentNames.clicked.connect( lambda i: self._selectResult(self.uRecentNames,i) )
     self.uFavourites.clicked.connect( lambda i: self._selectResult(self.uFavourites,i) )
     self.uAllUsers.toggled.connect( self._populateRecent )
     self.uEditOnly.toggled.connect( self._populateRecent )
     self.uMaxRecent.valueChanged.connect( lambda x: self._populateRecent )
     self.tabs.currentChanged.connect( self._populateTabList )
     self._controller.recentUpdated.connect(self._populateRecent)
     self._controller.nameEdited.connect( self._clearSearchDef )
     self._controller.favouritesUpdated.connect(self._populateFavourites)
     self._controller.mapExtentsChanged.connect( self._applyMapExtents )
开发者ID:iharrison,项目名称:gazetteer,代码行数:30,代码来源:NameSearchWidget.py

示例3: __init__

# 需要导入模块: from Controller import Controller [as 别名]
# 或者: from Controller.Controller import instance [as 别名]
 def __init__( self, controller=None, parent=None ):
     QWebView.__init__(self,parent)
     self._controller = controller
     if not self._controller:
         from Controller import Controller
         self._controller = Controller.instance()
     self._basedir=os.path.dirname(os.path.abspath(__file__))
     self._templatedir = os.path.join(self._basedir,'html')
     self._baseurl = QUrl.fromLocalFile(os.path.join(self._basedir,'html/'))
     self._templates={}
     self._template=None
     self._tempvars={}
     self._nameId = None
     self._name = None
     self._editingName = False
     self._isDirty = False
     self.setPage(self.MonitoredPage(self))
     self._frame = self.page().mainFrame()
     self._frame.javaScriptWindowObjectCleared.connect( self.setFrameController )
     self.setFrameController()
开发者ID:iharrison,项目名称:gazetteer,代码行数:22,代码来源:NameWebView.py

示例4: __init__

# 需要导入模块: from Controller import Controller [as 别名]
# 或者: from Controller.Controller import instance [as 别名]
    def __init__( self, parent=None, userOnly=True):
        QWidget.__init__( self, parent)
        self.setupUi( self )
        self._controller = Controller.instance()
        self._database = self._controller.database()
        self._adaptor = SqlAlchemyAdaptor(User)
        self._currentUser = self._database.user()
        self._allUsers = {};
        self.uUpdatingLabel.hide()
        
        self.uPublishDatabase.clicked.connect( self.publishData )
        self.uDownloadCSV.hide()
        self.uDownloadCSV.clicked.connect( self.downloadCsvFiles )
        self.uUsersTable.rowSelectionChanged.connect( self.populateSelectedUser )
        self.uUserName.textChanged.connect( lambda x: self.setUserEditButtons() )
        self.uUserIsAdmin.clicked.connect( self.setUserEditButtons )
        self.uAddUser.clicked.connect( lambda x: self.updateUser('add') )
        self.uRemoveUser.clicked.connect( lambda x: self.updateUser('remove') )
        self.uUpdateUser.clicked.connect( lambda x: self.updateUser('update') )

        self.populateUsers()
        self.populateLastWebUpdate()
开发者ID:iharrison,项目名称:gazetteer,代码行数:24,代码来源:AdminWidget.py

示例5: __init__

# 需要导入模块: from Controller import Controller [as 别名]
# 或者: from Controller.Controller import instance [as 别名]
    def __init__( self, parent=None ):

        # Import delayed to facilitate using as standalone module,
        # Makes setting path before import cleaner.

        import DatabaseConfiguration
        from Controller import Controller
        from NameSearchWidget import NameSearchDock
        from NameWebView import NameWebDock

        QMainWindow.__init__( self, parent )
        self._nameDockType = NameWebDock
        self._controller = Controller.instance()
        self._controller.setMainWindow( self )
        self._syscodeWindow = None
        self._helpWindow = None
        self._searchWindow = NameSearchDock()
        self._searchWindow.setFeatures(QDockWidget.NoDockWidgetFeatures)
        self.addDockWidget( Qt.LeftDockWidgetArea, self._searchWindow )
        self._searchWindow.nameSelected.connect( self._controller.showNameId )
        self._controller.nameViewCreated.connect( self.addNameView )
        # if self._controller.database().userIsDba():
        #     self.showAdminWidget()
        self.resize(600,600)
开发者ID:iharrison,项目名称:gazetteer,代码行数:26,代码来源:Editor.py


注:本文中的Controller.Controller.instance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。