def __doRun(self, settings, state): if not settings.enabled: return False else: reqs = _settings.createTutorialElement(settings.reqs) if not reqs.isEnabled(): return False descriptor = loadDescriptorData(settings, settings.exParsers) if descriptor is None: LOG_ERROR('Descriptor is not valid. Tutorial is not available', settings) return False cache = _cache.TutorialCache(BigWorld.player().name) cache.read() cache.setSpace(settings.space) if state.get('byRequest', False): cache.setRefused(False) runCtx = RunCtx(cache, **state) reqs.prepare(runCtx) if not reqs.process(descriptor, runCtx): return False self.clear() if self.__dispatcher is None: self.__setDispatcher(settings.dispatcher) tutorial = Tutorial(settings, descriptor) result = tutorial.run(weakref.proxy(self.__dispatcher), runCtx) if result: self.__tutorial = tutorial self.__tutorial.onStopped += self.__onTutorialStopped return result
def tryingToRun(self, runCtx): settings = TUTORIAL_SETTINGS.getSettings(runCtx.settings) if not settings.enabled: return else: runCtx.cache = TutorialCache.TutorialCache(BigWorld.player().name, settings.space) reqs = TUTORIAL_SETTINGS.factory(settings.reqs, init=(weakref.proxy(self), runCtx)) if reqs.isEnabled(): if self.__tutorial is None or self.__tutorial._settings.id != settings.id: self.__tutorial = Tutorial(settings) if self.__tutorial._descriptor is None: LOG_ERROR( 'Tutorial descriptor is not valid. Tutorial is not available.' ) return if self.__dispatcher is not None: self.__dispatcher.stop() self.__dispatcher = None self.__dispatcher = TUTORIAL_SETTINGS.factory( settings.dispatcher) self.__dispatcher.start(runCtx) self.__tutorial.setDispatcher(weakref.proxy(self.__dispatcher)) reqs.process() return
def enter(): clear_canvas() global soldier, space, tutorial soldier = Soldier() space = Space() tutorial = Tutorial()
def main(self, screen): pygame.mixer.init() clock = pygame.time.Clock() background = load_image('menu_background.png') music = load_sound('music_credits.ogg') menu = kezmenu.KezMenu( ['Engage', lambda: Quantum().mainLoop(40)], ['Enlighten', lambda: Tutorial().mainLoop(40)], ['Archive', lambda: Highscore().mainLoop(40)], ['Collaborating Minds', lambda: Credits().mainLoop(40)], ['Abort', lambda: setattr(self, 'running', False)], ) menu.x = 10 menu.y = 10 menu.enableEffect('raise-col-padding-on-focus', enlarge_time=0.1) menu.color = (0, 0, 255) menu.focus_color = (174, 23, 92) menu.font = load_font('adelle.ttf', 20) music.play(-1) while self.running: menu.update(pygame.event.get(), clock.tick(30) / 1000.) screen.blit(background, (0, 0)) menu.draw(screen) pygame.display.flip()
def tutorial_button(): #TODO Merge into level_button? result=False success=None error=None Tutorial.script = get_script_path() #TODO need to save? if Tutorial.script is not None: success, error = Tutorial.process_request(request.args['button']) return jsonify(success=success, error=error, next_url=State.lvl_title)
def enter(): clear_canvas() global soldier, space, tutorial, soldier_bullet_team, alien_team soldier = Soldier() space = Space() tutorial = Tutorial() soldier_bullet_team = creat_soldier_bullet_team() alien_team = creat_alien_team()
def choice(self) : name = input("이름을 입력해주세요 : ") age = input("나이를 입력해주세요 : ") f = open("data.txt", 'w') f.write(name + " ") f.write(age + " ") print("\n") print("안녕하세요 ! " + name + "님의 고등학교 진학을 도와드릴 '학교가고' 프로그램 입니다 :) ! ") print("\n") t = Tutorial() t.tutorial() arr = ["1. 컴퓨터 코딩","2. 회계 및 전산","3. 디자인","4. 조리 및 식품","5. 기계","6. 과학","7. 항공정비 및 항공서비스","8. 동물","9. 농사","10. 뷰티"] school = ["미림여자정보과학고등학교","서울여자상업고등학교","서울디자인고등학교","서울조리고등학교","수도전기공업고등학교","서울과학고등학교","강호항공고등학교","광주자연과학고등학교","충주농업고등학교","한국뷰티고등학교"] url = ['https://www.e-mirim.hs.kr/main.do', "http://sys.sen.hs.kr/index.do", "http://seodi.sen.hs.kr/51522/subMenu.do","http://kcas.hs.kr/", "http://sudo.sen.hs.kr/index.do", "http://sshs.hs.kr/index.do","http://school.jbedu.kr/kangho", "http://kns.hs.kr/main/main.php", "http://school.cbe.go.kr/cjagh-h","http://kbeauty.jje.hs.kr/"] for i in arr: print(i) print("원하는 분야의 번호를 입력하세요 : ") keyword = input() print("▼▽▼▽▼▽▼▽▼▽▼▽▼▽▼▽▼▽▼▽▼▽▼▽") print(arr[(int(keyword)-1)]) print("학교 : "+school[int(keyword)-1]) print("사이트 : "+url[int(keyword)-1]) print("▲△▲△▲△▲△▲△▲△▲△▲△▲△▲△▲△▲△") f.write(school[int(keyword)-1] + " ") f.write(url[int(keyword)-1] + " ") f.close()
def __doRun(self, settings, runCtx, byRequest = False): if not settings.enabled: return False reqs = _settings.createTutorialElement(settings.reqs) if not reqs.isEnabled(): return False descriptor = loadDescriptorData(settings, settings.exParsers) if descriptor is None: LOG_ERROR('Descriptor is not valid. Tutorial is not available', settings) return False runCtx.cache.setSpace(settings.space) if byRequest: runCtx.cache.setRefused(False) reqs.prepare(runCtx) if not reqs.process(descriptor, runCtx): return False self.clear() tutorial = Tutorial(settings, descriptor) result = tutorial.run(weakref.proxy(self.__dispatcher), runCtx) if result: self.__tutorial = tutorial self.__tutorial.onStopped += self.__onTutorialStopped return result
def __doRun(self, settings, runCtx, byRequest=False): if not settings.enabled: return False reqs = _settings.createTutorialElement(settings.reqs) if not reqs.isEnabled(): return False descriptor = loadDescriptorData(settings, settings.exParsers) if descriptor is None: LOG_ERROR('Descriptor is not valid. Tutorial is not available', settings) return False runCtx.cache.setSpace(settings.space) if byRequest: runCtx.cache.setRefused(False) reqs.prepare(runCtx) if not reqs.process(descriptor, runCtx): return False self.clear() tutorial = Tutorial(settings, descriptor) result = tutorial.run(weakref.proxy(self.__dispatcher), runCtx) if result: self.__tutorial = tutorial self.__tutorial.onStopped += self.__onTutorialStopped return result
def tryingToRun(self, runCtx): settings = TUTORIAL_SETTINGS.getSettings(runCtx.settings) if not settings.enabled: return runCtx.cache = TutorialCache.TutorialCache(BigWorld.player().name, settings.space) reqs = TUTORIAL_SETTINGS.factory(settings.reqs, init=(weakref.proxy(self), runCtx)) if reqs.isEnabled(): if self.__tutorial is None or self.__tutorial._settings.id != settings.id: self.__tutorial = Tutorial(settings) if self.__tutorial._descriptor is None: LOG_ERROR('Tutorial descriptor is not valid. Tutorial is not available.') return if self.__dispatcher is not None: self.__dispatcher.stop() self.__dispatcher = None self.__dispatcher = TUTORIAL_SETTINGS.factory(settings.dispatcher) self.__dispatcher.start(runCtx) self.__tutorial.setDispatcher(weakref.proxy(self.__dispatcher)) reqs.process()
import requests from bs4 import BeautifulSoup from tutorial import Tutorial # Scrapper BASE_URL = 'https://realpython.com' response = requests.get(BASE_URL) # realpython.com ..... response_content = response.content # click derecho ver código fuente de la página soup = BeautifulSoup(response_content, features='html.parser') tutorials = soup.find_all('div', class_='col-12 col-md-6 col-lg-4 mb-5') tutorials_list = [] for t in tutorials: title = t.find('h2', class_='card-title') image = t.find('img', class_='card-img-top') anchor = t.find('a') anchor = BASE_URL + anchor['href'] new_tutorial = Tutorial(title.text, anchor, image['src'], "0") tutorials_list.append(new_tutorial) # POO Almancenamos la información obtenida for t in tutorials_list: components_image_url = t.url_image.split('/media/') image_file_name = components_image_url[1] remote_image_request = requests.get(t.url_image) remote_image_content = remote_image_request.content #Descargamos las imagenes con el siguiente codigo with open(f'temp/{image_file_name}', 'wb') as image_file: image_file.write(remote_image_content) for item in tutorials_list: second_url = item.url response_url_article = requests.get(second_url) # realpython.com ..... content_url_article = response_url_article.content # click derecho ver código fuente de la página
class _TutorialLoader(object): def __init__(self): super(_TutorialLoader, self).__init__() self.__loggedDBIDs = set() self.__afterBattle = False self.__tutorial = None self.__dispatcher = None return def init(self): g_playerEvents.onGuiCacheSyncCompleted += self.__pe_onGuiCacheSyncCompleted g_playerEvents.onAvatarBecomePlayer += self.__pe_onAvatarBecomePlayer connectionManager.onDisconnected += self.__cm_onDisconnected windowsManager = GUIProxy.windowsManager() windowsManager.onInitBattleGUI += self.__wm_onInitBattleGUI windowsManager.onDestroyBattleGUI += self.__wm_onDestroyBattleGUI def fini(self): g_playerEvents.onGuiCacheSyncCompleted -= self.__pe_onGuiCacheSyncCompleted g_playerEvents.onAvatarBecomePlayer -= self.__pe_onAvatarBecomePlayer connectionManager.onDisconnected -= self.__cm_onDisconnected windowsManager = GUIProxy.windowsManager() windowsManager.onInitBattleGUI -= self.__wm_onInitBattleGUI windowsManager.onDestroyBattleGUI -= self.__wm_onDestroyBattleGUI if self.__tutorial is not None: self.__dispatcher.stop() self.__tutorial.stop() self.__loggedDBIDs.clear() return def _clear(self): self.__tutorial = None return @property def tutorial(self): return self.__tutorial @property def isAfterBattle(self): return self.__afterBattle def tryingToRun(self, runCtx): settings = TUTORIAL_SETTINGS.getSettings(runCtx.settings) if not settings.enabled: return else: runCtx.cache = TutorialCache.TutorialCache(BigWorld.player().name, settings.space) reqs = TUTORIAL_SETTINGS.factory(settings.reqs, init=(weakref.proxy(self), runCtx)) if reqs.isEnabled(): if self.__tutorial is None or self.__tutorial._settings.id != settings.id: self.__tutorial = Tutorial(settings) if self.__tutorial._descriptor is None: LOG_ERROR('Tutorial descriptor is not valid. Tutorial is not available.') return if self.__dispatcher is not None: self.__dispatcher.stop() self.__dispatcher = None self.__dispatcher = TUTORIAL_SETTINGS.factory(settings.dispatcher) self.__dispatcher.start(runCtx) self.__tutorial.setDispatcher(weakref.proxy(self.__dispatcher)) reqs.process() return def refuse(self): if self.__tutorial is not None: self.__tutorial.refuse() return def restart(self, afterBattle = False): self.__afterBattle = afterBattle self.tryingToRun(RunCtx(restart=True)) def reload(self, afterBattle = False): if self.__tutorial: result = self.__tutorial.reload(afterBattle=afterBattle) else: result = False return result def _doRun(self, ctx): if ctx.isInPrebattle: self.__tutorial.pause(ctx) else: self.__tutorial.run(ctx) def _doStop(self, reason = TUTORIAL_STOP_REASON.DEFAULT): if self.__tutorial is not None: self.__tutorial.stop(reason=reason) if self.__dispatcher is not None: self.__dispatcher.stop() return def __pe_onGuiCacheSyncCompleted(self, ctx): ctx = RunCtx(**ctx) ctx.isFirstStart = ctx.databaseID not in self.__loggedDBIDs self.__loggedDBIDs.add(ctx.databaseID) self.tryingToRun(ctx) def __pe_onAvatarBecomePlayer(self): self.__afterBattle = True self._doStop() def __cm_onDisconnected(self): self.__afterBattle = False self._doStop(reason=TUTORIAL_STOP_REASON.DISCONNECT) def __wm_onInitBattleGUI(self): self.tryingToRun(RunCtx(settings='BATTLE')) def __wm_onDestroyBattleGUI(self): self._doStop()
view_func=Main.as_view('main'), methods=['GET']) app.add_url_rule('/<page>/', view_func=Main.as_view('main'), methods=['GET']) app.add_url_rule('/gallery/', view_func=Gallery.as_view('gallery'), methods=['GET']) app.add_url_rule('/login/', view_func=Login.as_view('login'), methods=['GET', 'POST']) app.add_url_rule('/videos/', view_func=Videos.as_view('videos'), methods=['GET']) app.add_url_rule('/tutorial/', view_func=Tutorial.as_view('tutorial'), methods=['GET']) app.add_url_rule('/upload', view_func=Upload.as_view('upload'), methods=['GET']) app.add_url_rule('/upload', view_func=Validate.as_view('validate'), methods=['GET']) app.add_url_rule('/upload', view_func=Posted.as_view('posted'), methods=['GET']) @app.errorhandler(404) def page_not_found(error): return flask.render_template('404.html'), 404
def enter(): global tutorial tutorial = Tutorial() game_world.add_object(tutorial, 0)
def tutorial(self,widget): tutorial_window = Tutorial() tutorial_window.connect("delete-event", Gtk.main) tutorial_window.show_all()
import requests from bs4 import BeautifulSoup from tutorial import Tutorial # Scrapper BASE_URL = 'https://realpython.com' response = requests.get(BASE_URL) # realpython.com ..... response_content = response.content # click derecho ver código fuente de la página soup = BeautifulSoup(response_content, features='html.parser') tutorials = soup.find_all('div', class_='col-12 col-md-6 col-lg-4 mb-5') tutorials_list = [] for t in tutorials: title = t.find('h2', class_='card-title') image = t.find('img', class_='card-img-top') anchor = t.find('a') new_tutorial = Tutorial(title.text, anchor['href'], image['src']) tutorials_list.append(new_tutorial) # POO Almancenamos la información obtenida for t in tutorials_list: components_image_url = t.url_image.split('/media/') image_file_name = components_image_url[1] remote_image_request = requests.get(t.url_image) remote_image_content = remote_image_request.content with open(f'temp/{image_file_name}', 'wb') as image_file: image_file.write(remote_image_content)
class _TutorialLoader(object): def __init__(self): super(_TutorialLoader, self).__init__() self.__afterBattle = False self.__tutorial = None self.__dispatcher = None return def init(self): g_playerEvents.onAccountShowGUI += self.__pe_onAccountShowGUI g_playerEvents.onAvatarBecomePlayer += self.__pe_onAvatarBecomePlayer connectionManager.onDisconnected += self.__cm_onDisconnected windowsManager = GUIProxy.windowsManager() windowsManager.onInitBattleGUI += self.__wm_onInitBattleGUI windowsManager.onDestroyBattleGUI += self.__wm_onDestroyBattleGUI def fini(self): g_playerEvents.onAccountShowGUI -= self.__pe_onAccountShowGUI g_playerEvents.onAvatarBecomePlayer -= self.__pe_onAvatarBecomePlayer connectionManager.onDisconnected -= self.__cm_onDisconnected windowsManager = GUIProxy.windowsManager() windowsManager.onInitBattleGUI -= self.__wm_onInitBattleGUI windowsManager.onDestroyBattleGUI -= self.__wm_onDestroyBattleGUI if self.__tutorial is not None: self.__dispatcher.stop() self.__tutorial.stop() return def _clear(self): self.__tutorial = None return @property def tutorial(self): return self.__tutorial @property def isAfterBattle(self): return self.__afterBattle def tryingToRun(self, runCtx): settings = TUTORIAL_SETTINGS.getSettings(runCtx.settings) if not settings.enabled: return else: runCtx.cache = TutorialCache.TutorialCache(BigWorld.player().name, settings.space) reqs = TUTORIAL_SETTINGS.factory(settings.reqs, init=(weakref.proxy(self), runCtx)) if reqs.isEnabled(): if self.__tutorial is None or self.__tutorial._settings.id != settings.id: self.__tutorial = Tutorial(settings) if self.__tutorial._descriptor is None: LOG_ERROR( 'Tutorial descriptor is not valid. Tutorial is not available.' ) return if self.__dispatcher is not None: self.__dispatcher.stop() self.__dispatcher = None self.__dispatcher = TUTORIAL_SETTINGS.factory( settings.dispatcher) self.__dispatcher.start(runCtx) self.__tutorial.setDispatcher(weakref.proxy(self.__dispatcher)) reqs.process() return def refuse(self): if self.__tutorial is not None: self.__tutorial.refuse() return def restart(self, afterBattle=False): self.__afterBattle = afterBattle self.tryingToRun(RunCtx(restart=True)) def _doRun(self, ctx): if ctx.isInPrebattle: self.__tutorial.pause(ctx) else: self.__tutorial.run(ctx) def _doStop(self): if self.__tutorial is not None: self.__tutorial.stop() if self.__dispatcher is not None: self.__dispatcher.stop() return def __pe_onAccountShowGUI(self, ctx): self.tryingToRun(RunCtx(**ctx)) def __pe_onAvatarBecomePlayer(self): self.__afterBattle = True self._doStop() def __cm_onDisconnected(self): self.__afterBattle = False self._doStop() def __wm_onInitBattleGUI(self): self.tryingToRun(RunCtx(settings='BATTLE')) def __wm_onDestroyBattleGUI(self): self._doStop()