示例#1
0
    def onModuleLoad(self):
        try:
            setCookie(COOKIE_NAME, "setme", 100000)
        except:
            pass

        self.status = Label()
        self.text_area = TextArea()
        self.text_area.setText(r"Me eat cookie!")
        self.text_area.setCharacterWidth(80)
        self.text_area.setVisibleLines(8)
        self.button_py_set = Button("Set Cookie", self)
        self.button_py_read = Button("Read Cookie ", self)

        buttons = HorizontalPanel()
        buttons.add(self.button_py_set)
        buttons.add(self.button_py_read)
        buttons.setSpacing(8)
        info = r"This demonstrates setting and reading information using cookies."
        panel = VerticalPanel()
        panel.add(HTML(info))
        panel.add(self.text_area)
        panel.add(buttons)
        panel.add(self.status)

        RootPanel().add(panel)
示例#2
0
 def onSave(self, sender):
     try:
         setCookie("fileLocation", self.fileLocationInput.getText(),
                   1000000000)
     except:
         pass
     self.hide()
示例#3
0
    def onModuleLoad(self):
        try:
            setCookie(COOKIE_NAME, "setme", 100000)
        except:
            pass

        self.status = Label()
        self.text_area = TextArea()
        self.text_area.setText(r"Me eat cookie!")
        self.text_area.setCharacterWidth(80)
        self.text_area.setVisibleLines(8)
        self.button_py_set = Button("Set Cookie", self)
        self.button_py_read = Button("Read Cookie ", self)

        buttons = HorizontalPanel()
        buttons.add(self.button_py_set)
        buttons.add(self.button_py_read)
        buttons.setSpacing(8)
        info = r'This demonstrates setting and reading information using cookies.'
        panel = VerticalPanel()
        panel.add(HTML(info))
        panel.add(self.text_area)
        panel.add(buttons)
        panel.add(self.status)

        RootPanel().add(panel)
 def onFileLoaded(self, filename, data):
     def invalid(lineno, line):
         alert("Invalid line at %s:\n%s" % (lineno, line))
         return False
     date = self.timeProxy.importData(data, invalid)
     if date:
         setCookie("fileLocation", filename, 1000000000)
         self.sendNotification(Notification.DATE_SELECTED, date)
示例#5
0
 def onRemoteResponse(self, response, requestInfo):
     self.errorInfoLabel.setText('')
     d = datetime.date.today() + datetime.timedelta(days=1)
     setCookie("LoggedInUser", response, d, path='/')
     loggedInUser = json.loads(response)
     if loggedInUser["is_superuser"] == True:
         Window.setLocation("/admin.html")
     else:
         Window.setLocation("/home.html")
示例#6
0
文件: main.py 项目: antialize/djudge
 def onRemoteResponse(self, response, request_info):
     if response == "invalid_cookie":
         self.show()
     elif response == None or len(response) < 3:
         self.table.setHTML(3,0,"<b>Invalid username or password</b>")
     else:
         self.app.cookie = response[0]
         setCookie('cookie',response[0],1000*60*60*24)
         self.hide()
         self.app.logininit(response[1],response[2])
示例#7
0
 def onFileLoaded(self, filename, data):
     def invalid(lineno, line):
         alert("Invalid line at %s:\n%s" % (lineno, line))
         return False
     date = self.timeProxy.importData(data, invalid)
     if date:
         try:
             setCookie("fileLocation", filename, 1000000000)
         except:
             pass
         self.sendNotification(Notification.DATE_SELECTED, date)
示例#8
0
 def onClick(self, sender):
     """
     Run when any button is clicked
     """
     if sender.getText() == "Set Cookie":
         # clicked the set cookie button
         text = self.text_area.getText()
         # print goes to console.log
         print "setting cookie to:", text
         # Note: this sets the cookie on the top level
         setCookie(COOKIE_NAME, text, 10000, path="/")
     else:
         cookie_text = getCookie(COOKIE_NAME)
         if cookie_text is None:
             print "No Cookie"
         else:
             print "myCookie", cookie_text
             self.status.setText(cookie_text)
示例#9
0
 def onClick(self, sender):
     """
     Run when any button is clicked
     """
     if sender.getText() == "Set Cookie":
         #clicked the set cookie button
         text = self.text_area.getText()
         #print goes to console.log
         print "setting cookie to:", text
         #Note: this sets the cookie on the top level
         setCookie(COOKIE_NAME, text, 10000, path='/')
     else:
         cookie_text = getCookie(COOKIE_NAME)
         if cookie_text is None:
             print "No Cookie"
         else:
             print "myCookie", cookie_text
             self.status.setText(cookie_text)
示例#10
0
文件: admin.py 项目: sivapy/MyBlog
 def onCellClicked(self, sender, row, col):
     setCookie("SelectedBlog", self.blogs[row], 10000, path='/')
     value = self.selectedItem.getUserObject()
     if value == 0:
         setCookie("ShowPublishButton", 'True', 10000, path='/')
     elif value == 1:
         setCookie("ShowPublishButton", 'False', 10000, path='/')
示例#11
0
 def onSave(self, sender):
     try:
         setCookie("fileLocation", self.fileLocationInput.getText(), 1000000000)
     except:
         pass
     self.hide()
示例#12
0
 def onSave(self, sender):
     setCookie("fileLocation", self.fileLocationInput.getText(), 1000000000)
     self.hide()
示例#13
0
文件: main.py 项目: antialize/djudge
 def onOk(self, env):
     global gw
     setCookie('handle',self.handle.getText(),24*60*60*1000)
     x = self.pwd.getText()
     x = pwhash(x)
     gw.login(self.handle.getText(), x, self)
示例#14
0
文件: main.py 项目: antialize/djudge
 def logout(self, _):
     global gw
     gw.logout(self.cookie)
     self.cookie = None
     setCookie('cookie','',24*60*60)
     Window.getLocation().reload()
示例#15
0
文件: home.py 项目: sivapy/MyBlog
 def onCellClicked(self, sender, row, col):
     setCookie("SelectedBlog", self.blogs[row], 10000, path='/')
     setCookie("ShowPublishButton", 'False', 10000, path='/')