Ekspoint Posted December 16, 2016 Author Share Posted December 16, 2016 (edited) подскажите пожалуйста ,вот сделал, в ангаре кнопки есть. но почему на сайт не выкидывает когда нажимаю на кнопку куда вписан сайт? или такое уже не возможно сделать как раньше ? в питоне ошибок нет пока не нажмешь на кнопку. вот если нажать на кнопку1 то в питоне вот такие ошибки показывает. 2016-12-16 19:10:04.839: ERROR: Traceback (most recent call last): 2016-12-16 19:10:04.839: ERROR: File "mod_test", line 45, in new_onClickAction 2016-12-16 19:10:04.839: ERROR: NameError: global name 'openBrowserWindow' is not defined тебе нужно что бы в браузере игры открывало или системы? код давай свой Edited December 16, 2016 by Ekspoint @ Quote Link to comment Short link Share on other sites More sharing options...
Lom Posted December 16, 2016 Share Posted December 16, 2016 (edited) тебе нужно что бы в браузере игры открывало или системы? код давай свой кинул в личку) СПАСИБО БОЛЬШОЕ. ТЕПЕРЬ ВСЁ РАБОТАЕТ! ))) Edited December 18, 2016 by ЛОМ @ Quote Link to comment Short link Share on other sites More sharing options...
sergey spb Posted June 11, 2017 Share Posted June 11, 2017 Добрый день! При нажатии кнопки не открывается в браузере, что не так? # Embedded file name: mod_clik import BigWorld from notification.NotificationListView import NotificationListView from notification.settings import NOTIFICATION_BUTTON_STATE from gui.SystemMessages import SM_TYPE from adisp import process @process def openBrowserWindow(url, title): from gui import game_control width = 990 height = 550 browserSize = [width, height] yield game_control.g_instance.browser.load(url=url, title=title, showActionBtn=True, browserSize=browserSize, showCloseBtn=True) def messages(): return { 'typeID': 1, 'message': { 'bgIcon': '', 'defaultIcon': '', 'savedData': 0, 'timestamp': -1, 'filters': [], 'buttonsStates': {'cancel': NOTIFICATION_BUTTON_STATE.HIDDEN}, 'buttonsLayout': [{'action': 'action_1', 'type': 'submit', 'label': '\xd0\x9e\xd1\x82\xd0\xba\xd1\x80\xd1\x8b\xd1\x82\xd1\x8c', 'width': 100}, {'action': 'action_2', 'type': 'cancel', 'label': 'Button 2', 'width': 100}], 'message': '\xd0\x98\xd0\xbd\xd1\x84\xd0\xbe\xd1\x80\xd0\xbc\xd0\xb0\xd1\x86\xd0\xb8\xd1\x8f ModPackSG', 'type': 'black', 'icon': 'img://../icons/SG.png'}, 'entityID': 99999, 'auxData': ['GameGreeting'] } def new_getMessagesList(self): result = old_getMessagesList(self) if self._NotificationListView__currentGroup in 'info': result.append(messages()) return result old_getMessagesList = NotificationListView._NotificationListView__getMessagesList NotificationListView._NotificationListView__getMessagesList = new_getMessagesList def new_onClickAction(self, typeID, entityID, action): if action == 'action_1': openBrowserWindow('https://docviewer.yandex.ru/?url=ya-disk-public%3A%2F%2FzQ%2BixpkQPkBLxjSdk%2B5hLdC1vUIYT%2FnITuvj7140U9A%3D&name=%20information.docx&c=579508c0090d', '\xd0\x98\xd0\xbd\xd1\x84\xd0\xbe\xd1\x80\xd0\xbc\xd0\xb0\xd1\x86\xd0\xb8\xd1\x8f') elif action == 'action_2': print 'action_2' else: old_onClickAction(self, typeID, entityID, action) old_onClickAction = NotificationListView.onClickAction NotificationListView.onClickAction = new_onClickAction @ Quote Link to comment Short link Share on other sites More sharing options...
Lom Posted June 11, 2017 Share Posted June 11, 2017 Добрый день! При нажатии кнопки не открывается в браузере, что не так? # Embedded file name: mod_clik import BigWorld from notification.NotificationListView import NotificationListView from notification.settings import NOTIFICATION_BUTTON_STATE from gui.SystemMessages import SM_TYPE from adisp import process @process def openBrowserWindow(url, title): from gui import game_control width = 990 height = 550 browserSize = [width, height] yield game_control.g_instance.browser.load(url=url, title=title, showActionBtn=True, browserSize=browserSize, showCloseBtn=True) def messages(): return { 'typeID': 1, 'message': { 'bgIcon': '', 'defaultIcon': '', 'savedData': 0, 'timestamp': -1, 'filters': [], 'buttonsStates': {'cancel': NOTIFICATION_BUTTON_STATE.HIDDEN}, 'buttonsLayout': [{'action': 'action_1', 'type': 'submit', 'label': '\xd0\x9e\xd1\x82\xd0\xba\xd1\x80\xd1\x8b\xd1\x82\xd1\x8c', 'width': 100}, {'action': 'action_2', 'type': 'cancel', 'label': 'Button 2', 'width': 100}], 'message': '\xd0\x98\xd0\xbd\xd1\x84\xd0\xbe\xd1\x80\xd0\xbc\xd0\xb0\xd1\x86\xd0\xb8\xd1\x8f ModPackSG', 'type': 'black', 'icon': 'img://../icons/SG.png'}, 'entityID': 99999, 'auxData': ['GameGreeting'] } def new_getMessagesList(self): result = old_getMessagesList(self) if self._NotificationListView__currentGroup in 'info': result.append(messages()) return result old_getMessagesList = NotificationListView._NotificationListView__getMessagesList NotificationListView._NotificationListView__getMessagesList = new_getMessagesList def new_onClickAction(self, typeID, entityID, action): if action == 'action_1': openBrowserWindow('https://docviewer.yandex.ru/?url=ya-disk-public%3A%2F%2FzQ%2BixpkQPkBLxjSdk%2B5hLdC1vUIYT%2FnITuvj7140U9A%3D&name=%20information.docx&c=579508c0090d', '\xd0\x98\xd0\xbd\xd1\x84\xd0\xbe\xd1\x80\xd0\xbc\xd0\xb0\xd1\x86\xd0\xb8\xd1\x8f') elif action == 'action_2': print 'action_2' else: old_onClickAction(self, typeID, entityID, action) old_onClickAction = NotificationListView.onClickAction NotificationListView.onClickAction = new_onClickAction если нужно чтобы открывалось во внешнем браузере то вот так попробуй... def new_onClickAction(self, typeID, entityID, action): if action == 'action_1': BigWorld.wg_openWebBrowser('http://koreanrandom.com') elif action == 'action_2': BigWorld.wg_openWebBrowser('http://koreanrandom.com') else: old_onClickAction(self, typeID, entityID, action) 1 @ Quote Link to comment Short link Share on other sites More sharing options...
sergey spb Posted June 11, 2017 Share Posted June 11, 2017 если нужно чтобы открывалось во внешнем браузере то вот так попробуй... def new_onClickAction(self, typeID, entityID, action): if action == 'action_1': BigWorld.wg_openWebBrowser('http://koreanrandom.com') elif action == 'action_2': BigWorld.wg_openWebBrowser('http://koreanrandom.com') else: old_onClickAction(self, typeID, entityID, action) Спасибо!!! А как в браузере игры, не подскажешь? @ Quote Link to comment Short link Share on other sites More sharing options...
Lom Posted June 11, 2017 Share Posted June 11, 2017 (edited) Спасибо!!! А как в браузере игры, не подскажешь? Вроде так... def new_onClickAction(self, typeID, entityID, action): if action == 'action_1': g_browserWindow.browser('https://koreanrandom.com/', 'ля ля тополя', 'ля ля тополя', [900, 900]) elif action == 'action_2': BigWorld.wg_openWebBrowser('https://youtu.be/91kQvTGlBfU') else: old_onClickAction(self, typeID, entityID, action) сайт корейки откроется в браузере игры а ютуб во внешнем... P/S... и спасибо не мне а Ekspoint. это он мне всё показал и написал))) Edited June 11, 2017 by ЛОМ 1 @ Quote Link to comment Short link Share on other sites More sharing options...
sergey spb Posted June 11, 2017 Share Posted June 11, 2017 в браузере игры не открывается. @ Quote Link to comment Short link Share on other sites More sharing options...
Lom Posted June 11, 2017 Share Posted June 11, 2017 (edited) хз. только проверил у меня открывается. хотя тока заметил у тебя код чуть другой вероятно поэтому у тебя игровой браузер не открывает. я сам мало что в этом понимаю так что нужно ждать ответа спецов)) P/S... там по ходу другой код идёт.. Edited June 11, 2017 by ЛОМ @ Quote Link to comment Short link Share on other sites More sharing options...
night_dragon_on Posted June 11, 2017 Share Posted June 11, 2017 (edited) там по ходу другой код идёт.. При нажатии кнопки не открывается в браузере Пример: 'mod_Test.py' #=============================================================================================== # Константы #=============================================================================================== widthBW = 1000 heightBW = 600 #=============================================================================================== # Создание функции вызова окна встроенного браузера #=============================================================================================== from adisp import process from helpers import dependency from skeletons.gui.game_control import IBrowserController class BrowserWindow(object): @process def openBrowserWindow(self, url, title, browserID): global widthBW, heightBW width = int(widthBW) height = int(heightBW) browserSize = [width, height] browserCtrl = dependency.instance(IBrowserController) yield browserCtrl.load(url=url, title=title, browserID=browserID, browserSize=browserSize, showActionBtn=True, showCloseBtn=True, showWaiting=True) g_browserWindow = BrowserWindow() #=============================================================================================== # Создание окна в центре уведомлении с кнопкой #=============================================================================================== import BigWorld from notification.NotificationListView import NotificationListView from notification.settings import NOTIFICATION_BUTTON_STATE def messages(): return { 'typeID': 1, 'message': { 'bgIcon': '', 'defaultIcon': '', 'savedData': 0, 'timestamp': -1, 'filters': [], 'buttonsStates': {'cancel': NOTIFICATION_BUTTON_STATE.HIDDEN}, 'buttonsLayout': [ { 'action': 'action_1', 'type': 'submit', 'label': u'Кнопка 1', 'width': 80 }, { 'action': 'action_2', 'type': 'submit', 'label': u'Кнопка 2', 'width': 80 } ], 'type': 'black', 'icon': '', 'message': 'Пример - переход по ссылке', }, 'entityID': 99999, 'auxData': ['GameGreeting'] } orig_getMessagesList = NotificationListView._NotificationListView__getMessagesList def custom_getMessagesList(self): result = orig_getMessagesList(self) if self._NotificationListView__currentGroup in 'info': result.append(messages()) return result orig_onClickAction = NotificationListView.onClickAction def custom_onClickAction(self, typeID, entityID, action): if action == 'action_1': BigWorld.wg_openWebBrowser('https://worldoftanks.ru/') elif action == 'action_2': g_browserWindow.openBrowserWindow("https://koreanrandom.com/forum/", "Koreanrandom", "99999") else: orig_onClickAction(self, typeID, entityID, action) NotificationListView._NotificationListView__getMessagesList = custom_getMessagesList NotificationListView.onClickAction = custom_onClickAction Edited June 11, 2017 by night_dragon_on 3 @ Quote Link to comment Short link Share on other sites More sharing options...
sergey spb Posted June 11, 2017 Share Posted June 11, 2017 хз. только проверил у меня открывается. хотя тока заметил у тебя код чуть другой вероятно поэтому у тебя игровой браузер не открывает. я сам мало что в этом понимаю так что нужно ждать ответа спецов)) P/S... там по ходу другой код идёт.. Спасибо, большое!!! Всё получилось, кому надо, берите: import BigWorld from notification.NotificationListView import NotificationListView from notification.settings import NOTIFICATION_BUTTON_STATE from gui.SystemMessages import SM_TYPE from adisp import process def messages(): return {'typeID': 1, 'message': {'bgIcon': '', 'defaultIcon': '', 'savedData': 0, 'timestamp': -1, 'filters': [], 'buttonsStates': {'cancel': NOTIFICATION_BUTTON_STATE.HIDDEN}, 'buttonsLayout': [{'action': 'action_1', 'type': 'submit', 'label': '\xd0\x9e\xd1\x82\xd0\xba\xd1\x80\xd1\x8b\xd1\x82\xd1\x8c', 'width': 110}, {'action': 'action_2', 'type': 'cancel', 'label': 'Button 2', 'width': 90}], 'message': '\xd0\x98\xd0\xbd\xd1\x84\xd0\xbe\xd1\x80\xd0\xbc\xd0\xb0\xd1\x86\xd0\xb8\xd1\x8f', 'type': 'black', 'icon': 'img://../icons/SG.png'}, 'entityID': 99999, 'auxData': ['GameGreeting']} def new_getMessagesList(self): result = old_getMessagesList(self) if self._NotificationListView__currentGroup in 'info': result.append(messages()) return result old_getMessagesList = NotificationListView._NotificationListView__getMessagesList NotificationListView._NotificationListView__getMessagesList = new_getMessagesList import BigWorld from adisp import process from helpers import dependency from skeletons.gui.game_control import IBrowserController class BrowserWindow(object): @process def browser(self, url, title, browserID, browserSize): browserCtrl = dependency.instance(IBrowserController) yield browserCtrl.load(url=url, title=title, browserID=browserID, browserSize=browserSize, showActionBtn=True, showCloseBtn=True, showWaiting=True) g_browserWindow = BrowserWindow() def new_onClickAction(self, typeID, entityID, action): if action == 'action_1': g_browserWindow.browser('https://docviewer.yandex.ru', 'Please wait...', 'Pack', [990, 550]) elif action == 'action_2': print 'action_2' else: old_onClickAction(self, typeID, entityID, action) old_onClickAction = NotificationListView.onClickAction NotificationListView.onClickAction = new_onClickAction 1 1 @ Quote Link to comment Short link Share on other sites More sharing options...
sergey spb Posted June 15, 2017 Share Posted June 15, 2017 Добрый день! Не подскажете? Как прописать путь к изображению в папке (WoT/icon), чтобы открывалась картинка, а не сайт? Путь по иконке не получился: 'img://../icons/SG.png' @ Quote Link to comment Short link Share on other sites More sharing options...
Lom Posted June 15, 2017 Share Posted June 15, 2017 Как прописать путь к изображению в папке (WoT/icon), чтобы открывалась картинка, а не сайт? что бы вместо сайта при нажатии открывалась какая то картинка??? @ Quote Link to comment Short link Share on other sites More sharing options...
sergey spb Posted June 15, 2017 Share Posted June 15, 2017 (edited) Да, картинка сохранённая на компе, как:'icon': 'img://../icons/SG.png' . g_browserWindow.browser('Путь к картинке.jpg', 'Please wait...', 'Pack', [990, 550]) Edited June 15, 2017 by sergey spb @ Quote Link to comment Short link Share on other sites More sharing options...
Lom Posted June 15, 2017 Share Posted June 15, 2017 чтобы открывало картинку сохранённую на компе ? это хз. . а нельзя эту же картинку залить куда нить на хостинг и уже оттуда ссылку прописать в скрипт? @ Quote Link to comment Short link Share on other sites More sharing options...
sergey spb Posted June 15, 2017 Share Posted June 15, 2017 чтобы открывало картинку сохранённую на компе ? это хз. . а нельзя эту же картинку залить куда нить на хостинг и уже оттуда ссылку прописать в скрипт? Да, можно, но хотелось бы чтобы открывалась уже сохраненная как иконка. @ Quote Link to comment Short link Share on other sites More sharing options...
Ekspoint Posted June 16, 2017 Author Share Posted June 16, 2017 Да, можно, но хотелось бы чтобы открывалась уже сохраненная как иконка.никак @ Quote Link to comment Short link Share on other sites More sharing options...
spoter Posted June 16, 2017 Share Posted June 16, 2017 никак Можно. Скачиваешь картинку и локально через тег img открываешь. @ Quote Link to comment Short link Share on other sites More sharing options...
Lom Posted June 16, 2017 Share Posted June 16, 2017 Можно. Скачиваешь картинку и локально через тег img открываешь. типа вот так? img://gui/maps/icons/shell/ARMOR_PIERCING.png ? @ Quote Link to comment Short link Share on other sites More sharing options...
spoter Posted June 17, 2017 Share Posted June 17, 2017 типа вот так? img://gui/maps/icons/shell/ARMOR_PIERCING.png ? import os import urllib from gui import SystemMessages def getImg(name, link, reDownload): try: image = 'img://gui/html/%s' % name path = os.path.realpath(os.path.join('./res/gui/html', '%s' %name)) if not os.path.exists(path) or reDownload: urllib.urlretrieve('%s' % link, path) except StandardError: image = '' path = '' if image and path and os.path.exists(path): return image return imageWidth = 200 imageHeight = 200 image = getImg('testImg.png', 'https://koreanrandom.com/forum/uploads/profile/photo-37077.jpg?_r=1466606370', True) message = '<br/><img src=\"%s\" width=\"%s\" height=\"%s\">' % (image, imageWidth, imageHeight) SystemMessages.pushMessage(message, SystemMessages.SM_TYPE.GameGreeting) По итогам этого кода будет скачана картинка с именем testImg.png в папку ./res/gui/html для теста в Орионе запустите этот код, когда будешь в ангаре. 1 @ Quote Link to comment Short link Share on other sites More sharing options...
sergey spb Posted August 23, 2019 Share Posted August 23, 2019 (edited) Добрый вечер, кому не трудно помогите! Раньше открывалось в браузере игры, а сейчас нет (долгая загрузка и всё...) Делал по подобию из образцов и советов на форуме для себя, сам к сожалению не шарю. # Source Generated with Decompyle++ # File: mod_newclik .pyc (Python 2.7) import BigWorld from notification.NotificationListView import NotificationListView from notification.settings import NOTIFICATION_BUTTON_STATE from gui.SystemMessages import SM_TYPE from adisp import process def messages(): return { 'typeID': 1, 'message': { 'bgIcon': '', 'defaultIcon': '', 'savedData': 0, 'timestamp': -1, 'filters': [], 'buttonsStates': { 'cancel': NOTIFICATION_BUTTON_STATE.HIDDEN }, 'buttonsLayout': [ { 'action': 'action_1', 'type': 'submit', 'label': '\xd0\x9e\xd1\x82\xd0\xba\xd1\x80\xd1\x8b\xd1\x82\xd1\x8c', 'width': 110 }, { 'action': 'action_2', 'type': 'cancel', 'label': 'Button 2', 'width': 90 }], 'message': '\xd0\x98\xd0\xbd\xd1\x84\xd0\xbe\xd1\x80\xd0\xbc\xd0\xb0\xd1\x86\xd0\xb8\xd1\x8f ModPackSG', 'type': 'black', 'icon': 'img://../icons/SG.png' }, 'entityID': 99999, 'auxData': [ 'GameGreeting'] } def new_getMessagesList(self): result = old_getMessagesList(self) if self._NotificationListView__currentGroup in 'info': result.append(messages()) return result old_getMessagesList = NotificationListView._NotificationListView__getMessagesList NotificationListView._NotificationListView__getMessagesList = new_getMessagesList import BigWorld from adisp import process from helpers import dependency from skeletons.gui.game_control import IBrowserController class BrowserWindow(object): def browser(self, url, title, browserID, browserSize): browserCtrl = dependency.instance(IBrowserController) yield browserCtrl.load(url = url, title = title, browserID = browserID, browserSize = browserSize, showActionBtn = True, showCloseBtn = True, showWaiting = True) browser = process(browser) g_browserWindow = BrowserWindow() def new_onClickAction(self, typeID, entityID, action): if action == 'action_1': g_browserWindow.browser('http://sgtspb.ucoz.net/ModPack_SG.jpg', 'Please wait...', 'Pack', [ 1366, 768]) elif action == 'action_2': print 'action_2' else: old_onClickAction(self, typeID, entityID, action) old_onClickAction = NotificationListView.onClickAction NotificationListView.onClickAction = new_onClickAction Сейчас код такой, но открывается в браузере Windows, не подскажете ка переделать? Спасибо! # Source Generated with Decompyle++ # File: mod_newclik_win .pyc (Python 2.7) import BigWorld from notification.NotificationListView import NotificationListView from notification.settings import NOTIFICATION_BUTTON_STATE from gui.SystemMessages import SM_TYPE from adisp import process def messages(): return { 'typeID': 1, 'message': { 'bgIcon': '', 'defaultIcon': '', 'savedData': 0, 'timestamp': -1, 'filters': [], 'buttonsStates': { 'cancel': NOTIFICATION_BUTTON_STATE.HIDDEN }, 'buttonsLayout': [ { 'action': 'action_1', 'type': 'submit', 'label': '\xd0\x9e\xd1\x82\xd0\xba\xd1\x80\xd1\x8b\xd1\x82\xd1\x8c', 'width': 110 }, { 'action': 'action_2', 'type': 'cancel', 'label': 'Button 2', 'width': 90 }], 'message': '\xd0\x98\xd0\xbd\xd1\x84\xd0\xbe\xd1\x80\xd0\xbc\xd0\xb0\xd1\x86\xd0\xb8\xd1\x8f ModPackSG', 'type': 'black', 'icon': 'img://../icons/SG.png' }, 'entityID': 99999, 'auxData': [ 'GameGreeting'] } def new_getMessagesList(self): result = old_getMessagesList(self) if self._NotificationListView__currentGroup in 'info': result.append(messages()) return result old_getMessagesList = NotificationListView._NotificationListView__getMessagesList NotificationListView._NotificationListView__getMessagesList = new_getMessagesList import BigWorld from adisp import process from helpers import dependency from skeletons.gui.game_control import IBrowserController class BrowserWindow(object): def browser(self, url, title, browserID, browserSize): browserCtrl = dependency.instance(IBrowserController) yield browserCtrl.load(url = url, title = title, browserID = browserID, browserSize = browserSize, showActionBtn = True, showCloseBtn = True, showWaiting = True) browser = process(browser) g_browserWindow = BrowserWindow() def new_onClickAction(self, typeID, entityID, action): if action == 'action_1': BigWorld.wg_openWebBrowser('http://sgtspb.ucoz.net/ModPack_SG.jpg') elif action == 'action_2': print 'action_2' else: old_onClickAction(self, typeID, entityID, action) old_onClickAction = NotificationListView.onClickAction NotificationListView.onClickAction = new_onClickAction Edited August 23, 2019 by sergey spb @ Quote Link to comment Short link Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.