예제 #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)
예제 #4
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:
         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
파일: PreferencesDlg.py 프로젝트: Afey/pyjs
 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='/')