def __init__(self): gedit.Plugin.__init__(self) # load the plugin settings self.windows_count = 0 self.eng_map = {} self.words = {} self.dictionary_words = [] self.filepath = '~/.gnome2/gedit/autocomplete_settings.xml' self.config = ConfigModel(self.filepath) self.config.load()
from twisted.internet.endpoints import TCP4ServerEndpoint import data.clients import data.players import data.blocks from commands import commandList from plugins import commands as pluginCommands from config import bindIp as interfaceIp from config import myIpAddress as hostName from config import YAMLConfig as ConfigModel import plugins web_api_config = ConfigModel( "cfg/webapi.config.yml", { "port": 8080, "ServerName": "Unnamed Server", 'webRconEnabled': False, 'webRconKey': '' }, True) upStart = calendar.timegm(datetime.datetime.utcnow().utctimetuple()) peakPlayers = 0 class WEBRcon(Resource): isLeaf = True def render_GET(self, request): request.setHeader('content-type', "application/json") if 'key' not in request.args or request.args['key'][ 0] != web_api_config.get_key('webRconKey'):
class AutoCompletePlugin(gedit.Plugin): def __init__(self): gedit.Plugin.__init__(self) # load the plugin settings self.windows_count = 0 self.eng_map = {} self.words = {} self.dictionary_words = [] self.filepath = '~/.gnome2/gedit/autocomplete_settings.xml' self.config = ConfigModel(self.filepath) self.config.load() def activate(self, window): self.windows_count += 1 if self.config.get_scope() == "global": self.activate_with_global_scope(window) else: self.activate_with_local_scope(window) def activate_with_local_scope(self,window): # Create autocomplete engine in local scope mode engine = AutoCompleteEngine(str(self.windows_count), self.config, {}, []) engine.activate(window) self.eng_map[window] = engine def activate_with_global_scope(self,window): # Create autocomplete engine in global scope mode engine = AutoCompleteEngine(str(self.windows_count), self.config, self.words, self.dictionary_words) engine.activate(window) self.eng_map[window] = engine def deactivate(self, window): self.windows_count -= 1 engine = self.eng_map[window] engine.deactivate(window) self.eng_map[window] = None def is_configurable(self): return True def create_configure_dialog(self): dialog = ConfigurationDialog(self.config,self.config_changed_callback) return dialog def config_changed_callback(self): ws = [] for w in self.eng_map: self.deactivate(w) ws.append(w) self.eng_map = None self.words = None self.dictionary_words = None self.windows_count = 0 self.eng_map = {} self.words = {} self.dictionary_words = [] for window2 in ws: self.activate(window2)
def get_all_visible_config(self): return ConfigModel.query(ConfigModel.visible==True).order(ConfigModel.name)