-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d5b83d1
commit 351ff26
Showing
3 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
WOTSTAT/res/scripts/client/gui/mods/wot_stat/thirdParty/dataProviderExtension.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import BigWorld | ||
from ..utils import print_log | ||
from typing import List | ||
|
||
# typing for intellisense | ||
class ITrigger(object): | ||
def trigger(self, value=None): pass | ||
|
||
class IState(object): | ||
def getValue(self): pass | ||
def setValue(self, value): pass | ||
|
||
class IExtension(object): | ||
def createState(self, path, initialValue = None): | ||
# type: (List[str], any) -> IState | ||
pass | ||
|
||
def createTrigger(self, path): | ||
# type: (List[str]) -> ITrigger | ||
pass | ||
|
||
class IDataProviderSDK(object): | ||
version = None # type: int | ||
def registerExtension(self, name): | ||
# type: (str) -> IExtension | ||
pass | ||
|
||
|
||
onEventTrigger = None # type: ITrigger | ||
|
||
def triggerEvent(event): | ||
if onEventTrigger: | ||
onEventTrigger.trigger(event) | ||
|
||
def setupExtension(): | ||
global onEventTrigger | ||
|
||
if not hasattr(BigWorld, 'wotstat_dataProvider'): | ||
return | ||
|
||
provider = BigWorld.wotstat_dataProvider # type: IDataProviderSDK | ||
|
||
providerVersion = provider.version | ||
extension = provider.registerExtension('wotstat') | ||
onEventTrigger = extension.createTrigger(['onEvent']) | ||
|
||
print_log('Extension setup complete. Data provider version: %s' % str(providerVersion)) | ||
|
||
|
||
BigWorld.callback(0.1, setupExtension) |