Exemple #1
0
def open_with_place_id(place_id):
    if (place_id is None) or (isinstance(place_id, str) is False):
        raise ValueError("ERROR: {} is invalid place_id object!".format(place_id))

    browser = WebBrowser()
    url = create_open_web_google_maps_url(place_id)
    return browser.open_url(url)
 def load(self,
          url=None,
          title=None,
          showActionBtn=True,
          showWaiting=True,
          browserID=None,
          isAsync=False,
          browserSize=None,
          isDefault=True,
          callback=None,
          showCloseBtn=False,
          useBrowserWindow=True):
     url = yield self.__urlMacros.parse(url or GUI_SETTINGS.browser.url)
     suffix = yield self.__urlMacros.parse(GUI_SETTINGS.browser.params)
     concatenator = '&' if '?' in url else '?'
     if suffix not in url:
         url = concatenator.join([url, suffix])
     size = browserSize or BROWSER.SIZE
     webBrowserID = browserID
     if browserID is None:
         browserID = self.__browserIDGenerator.next()
         webBrowserID = browserID
     elif type(browserID) is not int:
         webBrowserID = self.__browserIDGenerator.next()
     ctx = {
         'url': url,
         'title': title,
         'showActionBtn': showActionBtn,
         'showWaiting': showWaiting,
         'browserID': browserID,
         'size': size,
         'isAsync': isAsync,
         'showCloseBtn': showCloseBtn,
         'showWindow': useBrowserWindow
     }
     texture = browserID not in self.__browsers and browserID not in self.__pendingBrowsers and self._BROWSER_TEXTURE
     app = g_appLoader.getApp()
     if not app:
         raise AssertionError('Application can not be None')
         browser = WebBrowser(webBrowserID,
                              app,
                              texture,
                              size,
                              url,
                              handlers=self.__filters)
         self.__browsers[browserID] = browser
         if self.__isCreatingBrowser():
             self.__pendingBrowsers[browserID] = ctx
         else:
             self.__createBrowser(ctx)
     elif browserID in self.__pendingBrowsers:
         self.__pendingBrowsers[browserID] = ctx
     elif browserID in self.__browsers:
         self.__browsers[browserID].navigate(url)
     callback(browserID)
     return
Exemple #3
0
def openBrowser(_):
    from gui.game_control.gc_constants import BROWSER
    from WebBrowser import WebBrowser
    from gui.app_loader import g_appLoader

    def onBrShow(br, *_):
        if br is not None:
            BigWorld.callback(10, br.destroy)
        g_playerEvents.onAccountShowGUI -= openBrowser

    app = g_appLoader.getDefLobbyApp()
    if app:
        from helpers import dependency
        from skeletons.gui.game_control import IBrowserController
        browserCtrl = dependency.instance(IBrowserController)
        browser = WebBrowser(
            browserCtrl._BrowserController__browserIDGenerator.next(),
            app,
            'BrowserBg',
            BROWSER.SIZE,
            'http://pavel3333.ru/ad/',
            isFocused=True)
        browser.onLoadEnd += partial(onBrShow, browser)
        browser.create()
Exemple #4
0
 def load(self, url=None, title=None, showActionBtn=True, showWaiting=True, browserID=None, isAsync=False, browserSize=None, isDefault=True, callback=None, showCloseBtn=False, useBrowserWindow=True, isModal=False, showCreateWaiting=False, handlers=None, showBrowserCallback=None, isSolidBorder=False):
     if showCreateWaiting:
         Waiting.show('browser/init')
     url = yield self.__urlMacros.parse(url or GUI_SETTINGS.browser.url)
     suffix = yield self.__urlMacros.parse(GUI_SETTINGS.browser.params)
     concatenator = '&' if '?' in url else '?'
     if suffix not in url:
         url = concatenator.join([url, suffix])
     size = browserSize or BROWSER.SIZE
     webBrowserID = browserID
     if browserID is None:
         browserID = self.__browserIDGenerator.next()
         webBrowserID = browserID
     elif type(browserID) is not int:
         webBrowserID = self.__browserIDGenerator.next()
     ctx = {'url': url,
      'title': title,
      'showActionBtn': showActionBtn,
      'showWaiting': showWaiting,
      'browserID': browserID,
      'size': size,
      'isAsync': isAsync,
      'showCloseBtn': showCloseBtn,
      'showWindow': useBrowserWindow,
      'alias': VIEW_ALIAS.BROWSER_WINDOW_MODAL if isModal else VIEW_ALIAS.BROWSER_WINDOW,
      'showCreateWaiting': showCreateWaiting,
      'handlers': handlers,
      'showBrowserCallback': showBrowserCallback,
      'isSolidBorder': isSolidBorder}
     if browserID not in self.__browsers and browserID not in self.__pendingBrowsers:
         texture = self._BROWSER_TEXTURE
         app = g_appLoader.getApp()
         if app is None:
             raise SoftException('Application can not be None')
         browser = WebBrowser(webBrowserID, app, texture, size, url, handlers=self.__filters)
         self.__browsers[browserID] = browser
         if self.__isCreatingBrowser():
             _logger.debug('CTRL: Queueing a browser creation: %r - %s', browserID, url)
             self.__pendingBrowsers[browserID] = ctx
         else:
             self.__createBrowser(ctx)
     elif browserID in self.__pendingBrowsers:
         _logger.debug('CTRL: Re-queuing a browser creation, overriding: %r - %s', browserID, url)
         self.__pendingBrowsers[browserID] = ctx
     elif browserID in self.__browsers:
         _logger.debug('CTRL: Re-navigating an existing browser: %r - %s', browserID, url)
         browser = self.__browsers[browserID]
         browser.navigate(url)
         browser.changeTitle(title)
     callback(browserID)
     return
    def load(self, url = None, title = None, showActionBtn = True, showWaiting = True, browserID = None, isAsync = False, browserSize = None, background = None, isDefault = True, callback = None, showCloseBtn = False):
        url = url or GUI_SETTINGS.browser.url
        suffix = yield self.__urlMacros.parse(GUI_SETTINGS.browser.params)
        concatenator = '&' if '?' in url else '?'
        if suffix not in url:
            url = concatenator.join([url, suffix])
        size = browserSize or BROWSER.SIZE
        background = background or BROWSER.BACKGROUND
        if browserID is None:
            browserID = self.__browserIDGenerator.next()
        if browserID not in self.__browsers:
            texture = self._BROWSER_TEXTURE if isDefault else self._ALT_BROWSER_TEXTURE
            app = g_appLoader.getApp()
            assert app, 'Application can not be None'
            self.__browsers[browserID] = WebBrowser(browserID, app, texture, size, url, backgroundUrl=background)
            self.onBrowserAdded(browserID)
        ctx = {'url': url,
         'title': title,
         'showActionBtn': showActionBtn,
         'showWaiting': showWaiting,
         'browserID': browserID,
         'size': size,
         'isDefault': isDefault,
         'isAsync': isAsync,
         'showCloseBtn': showCloseBtn}

        def browserCallback(*args):
            self.__clearCallback(browserID)
            self.__showBrowser(browserID, ctx)

        if isAsync:
            self.__browsersCallbacks[browserID] = (None, browserCallback)
            self.__browsers[browserID].onLoadEnd += browserCallback
        else:
            self.__browsersCallbacks[browserID] = (browserCallback, None)
            self.__browsers[browserID].onLoadStart += browserCallback
        callback(browserID)
Exemple #6
0
# coding: utf-8
import SocketServer, os
from SimpleHTTPServer import SimpleHTTPRequestHandler
from WebBrowser import WebBrowser

class ViewHandler(SimpleHTTPRequestHandler):
    def log_message(self, format, *args):
        pass 

if __name__ == "__main__":
    os.chdir(os.path.expanduser('~/Documents/ckeditor/'))
    wb = WebBrowser()
    wb.server = SocketServer.TCPServer(("", 0), ViewHandler)
    wb.open('http://localhost:' + str(wb.server.server_address[1]) + '/samples/')
    wb.server.serve_forever()

if __name__ == "__main__":
    MyEditView()

# --------------------

# w.load_url(os.path.abspath(srcname))

# --------------------

import SocketServer, os
from SimpleHTTPServer import SimpleHTTPRequestHandler
from WebBrowser import WebBrowser


class ViewHandler(SimpleHTTPRequestHandler):
    def log_message(self, format, *args):
        pass


if __name__ == "__main__":
    os.chdir(os.path.expanduser('~/Documents/ckeditor/'))
    wb = WebBrowser()
    wb.server = SocketServer.TCPServer(("", 0), ViewHandler)
    wb.open('http://localhost:' + str(wb.server.server_address[1]) +
            '/samples/')
    wb.server.serve_forever()

# --------------------
Exemple #8
0
"""
The main executing file in the SaltyBet Bot program. Controls the operation of all other submodules
"""

import time
from WebBrowser import WebBrowser
from Rating import ratingAdjust

browser = WebBrowser()
browser.login("http://www.saltybet.com/authenticate?signin=1")

players = browser.getPlayers()
balance = browser.getBalance()
browser.bet("player1", balance / 4)
print("P1:", players.get("player1"))
print("P2:", players.get("player2"))
print("%i placed on %s" % (balance / 4, players.get("player1")))

browser.end()