• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python pyjd.setup函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pyjd.setup函数的典型用法代码示例。如果您正苦于以下问题:Python setup函数的具体用法?Python setup怎么用?Python setup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了setup函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: main

def main(test_gen_out):

    pyjd.setup("public/uitest.html")
    t = RunTests(test_gen_out)
    t.add(LabelTest)
    t.add(EventTest)
    t.add(DOMTest)
    pyjd.run()
开发者ID:certik,项目名称:pyjamas,代码行数:8,代码来源:uitest.py


示例2: loadPage

        self.view_path = view_path
        #self.prev_keys = []
        #self.next_key = None
        self.loadPage(first_key)

    def loadPage(self, startkey=None):
        limit = int(self.page_size)+1
        view_url = self.db_url+self.view_path+'?limit=%d'%limit
        if startkey is not None:
            view_url += '&startkey="%s"'%startkey
        else:
            self.prev_keys = []

        self.first_button.setEnabled(False)
        self.next_button.setEnabled(False)
        self.prev_button.setEnabled(False)
        HTTPRequest().asyncGet(None, None, url=view_url,
                                handler=ViewLoader(self))

if __name__ == '__main__':
    pyjd.setup("public/viewer.html")

    full_url = Window.getLocation().getHref()
    db_url = '/'.join(full_url.split('/')[:4])+'/'
    view_url = '_all_docs'
    viewer = Viewer(db_url, RootPanel(), Window.alert, page_size=10)
    viewer.onModuleLoad()
    viewer.setView(view_url)

    pyjd.run()
开发者ID:CodeSturgeon,项目名称:slipcover,代码行数:30,代码来源:viewer.py


示例3: AppFacade

from ApplicationConstants import Notification
from controller.StartupCommand import StartupCommand
from view.components.AppFrame import AppFrame

class AppFacade(Facade):

    def __init__(self):
        self.initializeFacade()
        self.initializeController()
        self.registerCommand(Notification.STARTUP, StartupCommand)

    @staticmethod
    def getInstance():
        return AppFacade()

# workaround for pyjd xulrunner issue: timesheet uses XMLHttpRequest.
class TimerCls:
    def __init__(self):
        self.app = AppFacade.getInstance()
        Timer(1, self)
    def onTimer(self, tid):
        appFrame = AppFrame()
        self.app.sendNotification(Notification.STARTUP, appFrame)

if __name__ == '__main__':
    pyjd.setup("http://127.0.0.1/examples/timesheet/public/TimeSheet.html")
    t = TimerCls()
    pyjd.run()

开发者ID:Ludovic-Condette,项目名称:pyjs,代码行数:28,代码来源:TimeSheet.py


示例4: getattr

        else:
            if AsyncUpload.is_old_browser():
                Window.alert("Hmmm, your browser doesn't support this.")
            else:
                el = self.field.getElement()
                files = getattr(el, 'files')
                #TODO implement loop for multiple file uploads 
                file = JS("@{{files}}[0]") #otherwise pyjs thinks it's a string?
                AsyncUpload.asyncUpload(self.url, file, self)

    def onload(self, status):
        self.progress.setText('100%')

    def onerror(self, status):
        Window.alert("oh noes we got an " + str(status))

    def onprogress(self, loaded, total):
        if self.progress.getText() == '100%': return
        progress = (loaded / total)
        p = int(progress * 100)
        self.progress.setText(str(p) + '%')


if __name__ == '__main__':
    #Well it makes no sense whatsoever to run this as desktop!!
    pyjd.setup("public/Upload.html")
    app = Upload()
    app.onModuleLoad()
    pyjd.run()

开发者ID:brodybits,项目名称:pyjs,代码行数:29,代码来源:Upload.py


示例5: onElementMousemove

    
    def onElementMousemove(self,sender,event):
        x = DOM.eventGetClientX(event) - DOM.getAbsoluteLeft(self.canvas.getElement())
        y = DOM.eventGetClientY(event) - DOM.getAbsoluteTop(self.canvas.getElement())
        s = self.desc[self.elements.index(sender)]
        self.set_status('Mousemove on Element '+s+' at '+str(x)+', '+str(y))
        DOM.eventCancelBubble(event,True)

    def onElementDblClick(self,sender,event):
        x = DOM.eventGetClientX(event) - DOM.getAbsoluteLeft(self.canvas.getElement())
        y = DOM.eventGetClientY(event) - DOM.getAbsoluteTop(self.canvas.getElement())
        s = self.desc[self.elements.index(sender)]
        self.set_status('Doubleclick on Element '+s+' at '+str(x)+', '+str(y))
        DOM.eventCancelBubble(event,True)
        
    def onElementContextmenu(self, sender,event):
        x = DOM.eventGetClientX(event) - DOM.getAbsoluteLeft(self.canvas.getElement())
        y = DOM.eventGetClientY(event) - DOM.getAbsoluteTop(self.canvas.getElement())
        s = self.desc[self.elements.index(sender)]
        self.set_status('Contextmenue on Element '+s+' at '+str(x)+', '+str(y))
        DOM.eventCancelBubble(event,True)
        DOM.eventPreventDefault(event)
        
if __name__ == "__main__":    
    pyjd.setup("public/events.html")
    events=Events()
    RootPanel().add(events)
    events.draw()
    pyjd.run()

开发者ID:brodybits,项目名称:pyjs,代码行数:28,代码来源:events.py


示例6: onKeyDown

        txt = self.focussed and 'yes. now press keys' or 'no. keys fail now'
        self.add(HTML('focus: %s' % txt))

    def onKeyDown(self, sender, keyCode, modifiers = None):
        self.add(HTML('keyDOWN: %d' % keyCode))

def heightset(fred):
    DOM.setStyleAttribute(doc().body, 'height', '100%')

def marginset(fred):
    DOM.setStyleAttribute(doc().body, 'margin', '0px')

if __name__ == '__main__':

    pyjd.setup("public/ClickableRootPanel.html")

    bh = Button("Click me to set body height to 100%", heightset,
               StyleName='teststyle')
    b = Button("Click me to set body margin to 0", marginset,
               StyleName='teststyle')
    h = HTML("<b>Hello World</b> - watch for focus highlighting after click",
             StyleName='teststyle')

    panel = FocusPanel(Widget=h)
    gp = RootPanelListener(panel, StyleName='rootstyle')

    # as this is replacing the 'normal' usage of RootPanel(),
    # it is necessary to add this in 'by hand' so that the
    # window-close notification is 'hooked into', and so when
    # the browser window is closed, cleanups (onDetach) will
开发者ID:Afey,项目名称:pyjs,代码行数:30,代码来源:ClickableRootPanel.py


示例7: onControlValueChanged

    def onControlValueChanged(self, sender, old_value, new_value):
        if sender == self.label:
            self.b.setControlPos(new_value)
            self.b.setValue(new_value, 0)
        if sender == self.b:
            self.label.setControlPos(new_value)
            self.label.setValue(new_value, 0)

class ControlDemo:
    def onModuleLoad(self):

        p = HorizontalPanel()
        p.setSpacing(10)

        sc = SliderClass(False)
        p.add(sc)
        sc = SliderClass(True)
        p.add(sc)
        sc = SliderClass(True)
        p.add(sc)

        RootPanel().add(p)


if __name__ == '__main__':
    pyjd.setup("./public/ControlDemo.html")
    app = ControlDemo()
    app.onModuleLoad()
    pyjd.run()
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:29,代码来源:ControlDemo.py


示例8: EchoServicePHP

        if code != 0:
            self.status.setText("HTTP error %d: %s" %
                                (code, message))
        else:
            code = errobj['code']
            self.status.setText("JSONRPC Error %s: %s" %
                                (code, message))


class EchoServicePHP(JSONProxy):
    def __init__(self):
        JSONProxy.__init__(self, "services/EchoService.php", ["echo", "reverse", "uppercase", "lowercase", "nonexistant"])


class EchoServicePython(JSONProxy):
    def __init__(self):
        JSONProxy.__init__(self, "services/EchoService.py", ["echo", "reverse", "uppercase", "lowercase", "nonexistant"])

if __name__ == '__main__':
    # for pyjd, set up a web server and load the HTML from there:
    # this convinces the browser engine that the AJAX will be loaded
    # from the same URI base as the URL, it's all a bit messy...
    # Use the second pyjd.setup if you're using apache-php locally
    # as described in the README
    pyjd.setup("http://127.0.0.1:8000/public/JSONRPCExample.html")
    #pyjd.setup("http://127.0.0.1/examples/jsonrpc/public/JSONRPCExample.html")
    app = JSONRPCExample()
    app.onModuleLoad()
    pyjd.run()

开发者ID:chopin,项目名称:pyjs,代码行数:29,代码来源:JSONRPCExample.py


示例9: AppFacade

This application depends on puremvc for python,\n\
which doesn't seem to be available.\n\
See README.
""")

from puremvc.patterns.facade import Facade
from ApplicationConstants import Command
import controller, components

class AppFacade(Facade):

    def __init__(self):
        self.initializeFacade()
        self.initializeController()
        self.registerCommand(Command.STARTUP, controller.StartupCommand)
        self.registerCommand(Command.DELETE_USER, controller.DeleteUserCommand)
        self.registerCommand(Command.ADD_ROLE_RESULT, controller.AddRoleResultCommand)

    @staticmethod
    def getInstance():
        return AppFacade()


if __name__ == '__main__':

    pyjd.setup("./public/EmployeeAdmin.html")
    app = AppFacade.getInstance()
    pyjsApp = components.PyJsApp()
    app.sendNotification(Command.STARTUP, pyjsApp.appFrame)
    pyjd.run()
开发者ID:Ludovic-Condette,项目名称:pyjs,代码行数:30,代码来源:EmployeeAdmin.py


示例10: onModuleLoad

import pyjd # dummy in pyjs

from pyjamas.ui.RootPanel import RootPanel
from DayFilterWidget import DayFilterWidget
from SchoolCalendarWidget import SchoolCalendarWidget

class DynaTable:

    def onModuleLoad(self):
        slot = RootPanel("calendar")
        if slot is not None:
            calendar = SchoolCalendarWidget(15)
            slot.add(calendar)
            
            slot = RootPanel("days")
            if slot is not None:
                filterWidget = DayFilterWidget(calendar)
                slot.add(filterWidget)


if __name__ == '__main__':
    pyjd.setup("http://127.0.0.1/examples/dynamictable/public/DynaTable.html") # dummy in pyjs
    app = DynaTable()
    app.onModuleLoad()
    pyjd.run() # dummy in pyjd
开发者ID:anandology,项目名称:pyjamas,代码行数:25,代码来源:DynaTable.py


示例11: CaptionPanel

        grid.setWidget(2, 0, CaptionPanel('Subclassing Timer()&nbsp;&nbsp;(<em>again</em>)',
                                          ptb, StyleName='left'))
        grid.setWidget(2, 1, ptb.box)
        grid.setWidget(2, 2, HTML('''This is the same as the previous
                                  example and is here to demonstrate
                                  creating multiple timers (each with
                                  their own state) which is difficult
                                  to do without sublcassing''', StyleName='desc'))

        # random color
        randomcolor = RandomColor()
        grid.setWidget(3, 0, CaptionPanel('Using onTimer()', randomcolor.hpanel, StyleName='left'))
        grid.setWidget(3, 1, randomcolor.colorpanel)
        grid.setWidget(3, 2, HTML(RandomColor.__doc__, StyleName='desc'))

        # add it all to the root panel
        RootPanel().add(grid)

        # kickstart the slider handle (see above concerning a
        # potential bug)
        randomcolor.initialize()

def onModuleLoad():
    timerdemo()

if __name__ == '__main__':

    pyjd.setup("public/timerdemo.html")
    onModuleLoad()
    pyjd.run()
开发者ID:anandology,项目名称:pyjamas,代码行数:30,代码来源:timerdemo.py


示例12: pyjamas

#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Distributed as part of pyjamas (http://pyjs.org)

import pyjd # dummy in pyjs
from Photos import Photos
from pyjamas.ui.RootPanel import RootPanel


class PicasaWeb:
    def onModuleLoad(self):
        self.photos=Photos() 
        RootPanel().add(self.photos)
    

if __name__ == '__main__':
    # for pyjd, set up a web server and load the HTML from there:
    # this convinces the browser engine that the AJAX will be loaded
    # from the same URI base as the URL, it's all a bit messy...
    pyjd.setup("public/PicasaWeb.html")
    app = PicasaWeb()
    app.onModuleLoad()
    pyjd.run()

开发者ID:anandology,项目名称:pyjamas,代码行数:29,代码来源:PicasaWeb.py


示例13: DecoratedTabPanel

        self.fTabs = DecoratedTabPanel(Size=("600px", "100%"))
        self.fTabs.add(self.createImage("rembrandt/JohannesElison.jpg"), red, True)
        self.fTabs.add(self.createImage("rembrandt/SelfPortrait1640.jpg"), green, True)
        self.fTabs.add(self.createImage("rembrandt/LaMarcheNocturne.jpg"), "1642")
        self.fTabs.add(self.createImage("rembrandt/TheReturnOfTheProdigalSon.jpg"), "1662")
        self.fTabs.selectTab(0)

        dp = DecoratorTitledPanel("Tabs", "bluetitle", "bluetitleicon",
                      ["bluetop", "bluetop2", "bluemiddle", "bluebottom"])
        dp.add(self.fTabs)
        RootPanel().add(dp)

    def createImage(self, imageUrl):
        image = Image(imageUrl)
        image.setStyleName("ks-images-Image")
        
        p = VerticalPanel()
        p.setHorizontalAlignment(HasAlignment.ALIGN_CENTER)
        p.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)
        p.add(image)

        return p

if __name__ == '__main__':
    pyjd.setup("./public/Tabs.html")
    app = Tabs()
    app.onModuleLoad()
    pyjd.run()

开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:28,代码来源:Tabs.py


示例14: updatePageDisplay

    def updatePageDisplay(self):
        if self.page<self.min_page: self.page=self.min_page
        elif self.page>self.max_page: self.page=self.max_page
        total_pages=(self.max_page-self.min_page) + 1
        
        self.g.setHTML(0, 4, "<b>page %d of %d</b>" % (self.page, total_pages))
        
        if self.page>=self.max_page:
            self.addb.setEnabled(False)
        else:
            self.addb.setEnabled(True)
            
        if self.page<=self.min_page:
            self.subb.setEnabled(False)
        else:
            self.subb.setEnabled(True)

        for y in range(1, 5):
            for x in range(5):
                self.g.setText(y, x, "%d (%d,%d)" % (self.page, x, y))

def AppInit():
    return GridWidget()

if __name__ == '__main__':
    pyjd.setup("./GridTest.html")
    g = GridWidget()
    RootPanel().add(g)
    pyjd.run()
开发者ID:anandology,项目名称:pyjamas,代码行数:29,代码来源:GridTest.py


示例15: Index

import pyjd # this is dummy in pyjs.
import pygwt

from Index import Index

if __name__ == '__main__':
	pyjd.setup("public/Main.html")
	app = Index()
	app.onModuleLoad()
	pyjd.run()


开发者ID:molhokwai,项目名称:libraries,代码行数:10,代码来源:Main.py


示例16: onCompletion

class getRec:
	def onCompletion(self, text):
		result = loads(text)
		findMovie(result['movie_id'])
		findRating(result['movie_id'])
		mainpage.mid = result['movie_id']
		

class Site:
	def __init__(self):
		self.mid = None
		HTTPRequest().asyncGet("http://student02.cse.nd.edu:40001/recommendations/156", getRec(self))


if __name__=='__main__':
	pyjd.setup("public/primer.html")
	mainpage = Site()
	l = Label("Enter movie ID:")
	movie = Label("Movie Title Displayed Here if Found")
	movieRating = Label("Movie Rating Displayed Here if Found")
	poster = Image()
	b1 = Button("Up",upvote)
	b2 = Button("Down", downvote)
	absolute = AbsolutePanel()
	absolute.add(poster,50,25)
	absolute.add(b1,0,100)
	absolute.add(b2,250,100)
	absolute.add(movie,50,0)
	absolute.add(movieRating,50,315)
	absolute.setWidth("100%")
        absolute.setHeight("100%")
开发者ID:RyanAMoran,项目名称:Python-Movie-Recommender,代码行数:31,代码来源:movie.py


示例17: RootPanel

import pyjd # this is dummy in pyjs.

from pyjamas.ui.RootPanel import RootPanel
from pyjamas.ui.Label import Label
from pyjamas import Window


if __name__ == '__main__':
    pyjd.setup("")

    RootPanel().add(Label("Hello World"))
    Window.alert("Hello World")
开发者ID:mahomahomaho,项目名称:dj-pyjs-skeletor,代码行数:12,代码来源:main.py


示例18: loadSinks

        self.sinkContainer.setCellVerticalAlignment(self.curSink,
                                                    HasAlignment.ALIGN_TOP)
        self.curSink.onShow()

    def loadSinks(self):
        HTTPRequest().asyncGet("contents.txt", ChapterListLoader(self))

    def setChapters(self, chapters):
        for l in chapters:
            name = l[0]
            desc = l[1]
            self.sink_list.addSink(Chapter.init(name, desc))

        #Show the initial screen.
        initToken = History.getToken()
        if len(initToken):
            self.onHistoryChanged(initToken)
        else:
            self.showInfo()


    def showInfo(self):
        self.show(self.sink_list.sinks[0], False)


if __name__ == '__main__':
    pyjd.setup("http://127.0.0.1/pyjamas/doc/book/public/Bookreader.html")
    app = Bookreader()
    app.onModuleLoad()
    pyjd.run()
开发者ID:Afey,项目名称:pyjs,代码行数:30,代码来源:Bookreader.py


示例19: AppInit

        
        # Hours
        self.saveContext()
        self.rotate( ((2*pi)/12)*hours + pi)
        self.fillRect(-2,-2,4,self.width * 0.2) 
        self.restoreContext()
        
        self.restoreContext()
        
        self.drawImage(self.clock.getElement(),0,0)


def AppInit():

    img_url = Window.getLocation().getSearchVar("img")
    if not img_url:
        img_url = 'images/chrome_clock.png'
    solar = SolarCanvas(img_url)
    
    solar.isActive = True
    solar.onTimer()

    return solar


if __name__ == '__main__':
    pyjd.setup("./public/Widgets.html")
    app = Widgets()
    app.onModuleLoad()
    pyjd.run()
开发者ID:anandology,项目名称:pyjamas,代码行数:29,代码来源:Widgets.py


示例20: loadPageList

    def loadPageList(self):
        HTTPRequest().asyncGet("sidebar.html",
                               PageLoader(self, "sidebar", "contents"))
        HTTPRequest().asyncGet("header.html", 
                               PageLoader(self, "header", "contents"))
        HTTPRequest().asyncGet("footer.html", 
                               PageLoader(self, "footer", "contents"))
        HTTPRequest().asyncGet("contents.txt", 
                               PageListLoader(self, "contents"))

    def loadPages(self, pages, purpose):
        if purpose == 'contents':
            self.pages = {}
            self.page_list = pages
        elif purpose == 'faq':
            self.faq_pages = {}
            self.faq_list = pages

        for l in pages:
            title = l[0]
            desc = l[1]
            HTTPRequest().asyncGet(desc, PageLoader(self, title, purpose))


if __name__ == '__main__':
    pyjd.setup("http://127.0.0.1/pyjamas/doc/pyjs_site/public/index.html")
    app = Tabs()
    app.onModuleLoad()
    pyjd.run()
开发者ID:brodybits,项目名称:pyjs.org,代码行数:29,代码来源:website.py



注:本文中的pyjd.setup函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python jenkins.Jenkins类代码示例发布时间:2022-05-25
下一篇:
Python pyjd.run函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap