def __init__(self,win): base.__init__(self,win) self.createNew = dg.DirectButton(parent = self.frame, text = (lang('gui.button.new')), pos = (-0.2,0,-0.7), scale = buttonsize, command = win.opennewworld) self.back = dg.DirectButton(parent = self.frame, text = (lang('gui.button.back')), pos = (0.15,0,-0.7), scale = buttonsize, command = win.openmain)
def __init__(self,win): base.__init__(self,win) self.cancel = dg.DirectButton(parent = self.frame, text = (lang('gui.button.cancel')), pos = (0,0,-0.7), scale = buttonsize, command = win.openmain) self.worldname = dg.DirectEntry(parent = self.frame, text = (lang('gui.game.name')), pos = (0,0,0), width = 2, numLines = 1, command = win.makenewworld)
def _load(self, hconf): for i in range(len(self._cd)): md = self._cdMeta[i] track = Track(self._cd[i+1], i+1) tm = TrackMeta() tm.track_no = md.track_number tm.duration = (track._track.end-track._track.start) / 75.0 tm.name = md.track_name tm.artist = md.artist_name tm.performer = md.performer_name tm.composer = md.composer_name tm.conductor = md.conductor_name tm.isrc = md.ISRC tm.album_name = md.album_name tm.year = md.year tm.date = md.date tm.catalog = md.catalog if tm.name == None: tm.name = u"{} #{}".format(lang(hconf=hconf)["track"], tm.track_no) for k in ["artist", "performer", "composer", "conductor", "isrc", "album_name", "year", "date", "catalog"]: if eval("tm.{}".format(k)) == None: exec('tm.{} = ""'.format(k)) track.meta = tm self.tracks.append( track )
def __init__(self, parent, *args, **kwds): self.parent = parent wx.Dialog.__init__(self, parent, *args, **kwds) self.lang = lang.lang(hconf=self.parent.hconf) self.__init_wx() tc = 0 for i in range(self.parent.trackList.GetItemCount()): if self.parent.trackList.IsChecked(i): tc += 1 self.finished = False self.progress = 0 self.starttime = 0 self.prepareFinished = False self.readtracksFinished = False self.connecttracksFinished = False self.laststepsFinished = False self.doConnect = parent.radio_onefile.GetValue() self.tracksCount = tc self.tracksFinished = 0 self.restSecounds = 0 #so viele Sekunden muessen insgesammt noch ausgelesen werden self.saved_time = 0 self.saved_secs = 0 #so viele Sekunden wurden in der Zeit saved_time gespeichert self.resttime = 0 self.resttimeAtTime = 0 #zu diesem zeitpunkt wurde die resttime gesetzt self.canceld = False self.error = False self.traceback = None self.ext = {0:"mp3", 1:"mp2", 2:"wav", 3:"ogg", 4:"flac"}[parent.choice_container.GetSelection()] for i in range(self.tracksCount): self.restSecounds += self.parent.device.tracks[i].meta.duration
def create_bot(config): config_ = get_config(config) logger.setLevel(config_.log_level) formatter = logging.Formatter(config_.log_format) #fhandler = logging.FileHandler(config_.log_file) #fhandler.setLevel(config_.log_level) #fhandler.setFormatter(formatter) #logger.addHandler(fhandler) shandler = logging.StreamHandler() shandler.setLevel(config_.log_level) shandler.setFormatter(formatter) logger.addHandler(shandler) apihelper.proxy = config_.proxy bot = telebot.TeleBot(config_.token, threaded=config_.bot_threaded, skip_pending=config_.bot_skip_pending, num_threads=config_.bot_num_threads) bot.logger = logger bot.scheduler = BackgroundScheduler() bot.config = config_ bot.lang = lang() bot.db = DB(config_) init_handlers(bot) return bot
def __init__(self,win): base.__init__(self,win) #TODO Add more buttons. self.back = dg.DirectButton(parent = self.frame, text = (lang('gui.button.back')), pos = (0,0,-0.7), scale = buttonsize, command = win.openmain)
def __init__(self,win): base.__init__(self,win) self.musicVolume = dg.DirectSlider(parent = self.frame, pos = (0,0,-0.4), scale = 0.4, value = 0.6, command = win.setmusicvolume) self.back = dg.DirectButton(parent = self.frame, text = (lang('gui.button.back')), pos = (0,0,-0.7), scale = buttonsize, command = win.openmain) self.lang = dg.DirectOptionMenu(parent = self.frame, text = (lang('gui.options.lang')), pos = (0,0,-0.1), scale = buttonsize, items = ['Default']+lang_.supported.keys(), initialitem = 0, command = win.selectlang)
def __init__(self,win): base.__init__(self,win) self.loadgame = dg.DirectButton(parent = self.frame, text = (lang('gui.button.story')), pos = (0,0,-0.2), scale = buttonsize, command = win.openstorymode) self.playonline = dg.DirectButton(parent = self.frame, text = (lang('gui.button.free')), pos = (0,0,-0.4), scale = buttonsize, command = win.openfreeplay) self.options = dg.DirectButton(parent = self.frame, text = (lang('gui.button.options')), pos = (0,0,-0.6), scale = buttonsize, command = win.openoptions) self.title = dg.OnscreenText(parent = self.frame, text = lang('gui.title'), style = 3, fg = (1, 1, 1, 1), pos = (0,0.75,0), scale = 0.3) self.copyright = dg.OnscreenText(parent = self.frame, text = lang('gui.copyright'), style = 3, fg = (1, 1, 1, 1), pos = (-0.45,-0.95,0), scale = 0.05) self.copyright = dg.OnscreenText(parent = self.frame, text = lang('gui.version'), style = 3, fg = (1, 1, 1, 1), pos = (0,0.58,0), scale = 0.1)
def __init__(self): self.lang = lang()
import os import traceback #Third-party modules import xbmc import xbmcgui #Project modules import act import config import lang import log import dvd """Handles the user interface layer""" lang = lang.lang() #http://xbmc.sourceforge.net/python-docs/xbmcgui.html#Dialog-browse browseTypes = { 'ShowAndGetDirectory' : 0, 'ShowAndGetFile' : 1, 'ShowAndGetImage' : 2, 'ShowAndGetWriteableDirectory' : 3 } """ Description: Handles the flow for adding via a batch file """ def addBatch(): fileBrowser = xbmcgui.Dialog()
def __init_lang(self): self.lang = lang.lang(hconf=self.hconf)
def init_contests(): all_langs = langs.insert_many([ # Compile langs lang('C', 'c', 'c_cpp', 'gcc -O2 -Wall -std=c11 {} -o {} -static', './{}').to_object(), lang('C++', 'cpp', 'c_cpp', 'g++ -O2 -Wall -std=c++14 {} -o {} -static', './{}').to_object(), # Script langs lang('Python', 'py', 'python', 'cp {} {}', 'python {}').to_object(), lang('Node.JS', 'js', 'javascript', 'cp {} {}', 'node {}').to_object(), ]).inserted_ids all_checkers = checkers.insert_many([ checker('diff', 'diff (out1) (out2)').to_object(), checker('diff - ignore all white space', 'diff -w (out1) (out2)').to_object(), ]).inserted_ids all_tests = tests.insert_many([ test('', '2').to_object(), test('', '3').to_object(), ]).inserted_ids curr_tasks = tasks.insert_many([ task('1+1', '# 1+1\nPrint the result of 1+1 on the standart output.', [all_tests[0]], all_checkers[0], True).to_object(), task('1+2', '# 1+2\nPrint the result of 1+2 on the standart output.', [all_tests[1]], all_checkers[1], False).to_object(), ]).inserted_ids curr_contests = contests.insert_many([ # Active contest('The director\'s cake - group X', [all_langs[0], all_langs[1]], "2017-04-12 12:30", "2018-04-12 16:30", curr_tasks).to_object(), contest('The director\'s cake - group Y', [all_langs[0], all_langs[1]], "2017-04-12 12:30", "2018-04-12 16:30", []).to_object(), contest('The director\'s cake - group Z', [all_langs[0], all_langs[1]], "2017-04-12 12:30", "2018-04-12 16:30", []).to_object(), # Past contest('The director\'s cake', all_langs, "2014-04-12 12:30", "2014-04-12 16:30", []).to_object(), contest('The director\'s cake', all_langs, "2014-04-12 12:30", "2014-04-12 16:30", []).to_object(), # Future contest('The director\'s cake', all_langs, "2021-04-12 12:30", "2021-04-12 16:30", []).to_object(), contest('The director\'s cake', all_langs, "2021-04-12 12:30", "2021-04-12 16:30", []).to_object(), ]).inserted_ids solutions.insert_many([ solution(curr_contests[0], curr_tasks[0], users.find_one({})['_id'], '', 'py').to_object(), solution(curr_contests[0], curr_tasks[0], users.find_one({})['_id'], '', 'py').to_object(), solution(curr_contests[0], curr_tasks[0], users.find_one({})['_id'], '', 'py').to_object(), solution(curr_contests[0], curr_tasks[0], users.find_one({})['_id'], '', 'py').to_object(), solution(curr_contests[0], curr_tasks[0], users.find_one({})['_id'], '', 'py').to_object(), solution(curr_contests[0], curr_tasks[0], users.find_one({})['_id'], '', 'py').to_object(), solution(curr_contests[0], curr_tasks[0], users.find_one({})['_id'], '', 'py').to_object(), solution(curr_contests[0], curr_tasks[0], users.find_one({})['_id'], '', 'py').to_object(), solution(curr_contests[0], curr_tasks[0], users.find_one({})['_id'], '', 'py').to_object(), solution(curr_contests[0], curr_tasks[0], users.find_one({})['_id'], '', 'py').to_object(), solution(curr_contests[0], curr_tasks[0], users.find_one({})['_id'], '', 'py').to_object(), solution(curr_contests[0], curr_tasks[0], users.find_one({})['_id'], '', 'py').to_object(), solution(curr_contests[0], curr_tasks[0], users.find_one({})['_id'], '', 'py').to_object(), solution(curr_contests[0], curr_tasks[0], users.find_one({})['_id'], '', 'py').to_object(), solution(curr_contests[0], curr_tasks[0], users.find_one({})['_id'], '', 'py').to_object(), solution(curr_contests[0], curr_tasks[0], users.find_one({})['_id'], '', 'py').to_object(), ])
import vk_api import lang from vk_api.keyboard import VkKeyboard, VkKeyboardColor from vk_api.utils import get_random_id langs = lang.lang() class VapeBot: cache = {} def __init__(self, token): self.token = token self.vk = vk_api.VkApi(token=token).get_api() def PrepareUser(self, uid): if not uid in self.cache: self.cache[uid] = {"activity": 0} def SetActivity(self, uid, id): self.cache[uid]["activity"] = id def GetActivity(self, uid): return self.cache[uid]["activity"] def SetLocal(self, uid, key, value): self.cache[uid][key] = value def GetLocal(self, uid, key): return self.cache[uid][key]