def draw(self):
        Popup.draw(self)

        namePanel = HorizontalPanel()
        namePanel.add(Label(_('Name') + ':'))
        self.textBox = TextBox()
        self.textBox.setMaxLength(15)
        self.textBox.setStyleAttribute('marginLeft', 10)
        namePanel.add(self.textBox)
        self.center.add(namePanel)

        self.choose = ChooseTypeVarPanel()
        self.center.add(self.choose)

        self.textBox.addInputListener(self)

        self.message = Element(Element=DOM.createDiv())
        self.message.add(Widget(Element=DOM.createDiv(),
                                StyleName='not_image'))
        self.message.add(
            Label(text=_('Name already used'),
                  wordWrap=False,
                  StyleName='not_message'))

        self.onInput()
Exemple #2
0
    def __init__(self, milestone_names, milestone_dates):
        # We need to use old form of inheritance because of pyjamas
        SimplePanel.__init__(self)
        self.milestone_dates = milestone_dates
       
        self.hpanel = HorizontalPanel()
        self.hpanel.setVerticalAlignment(HasAlignment.ALIGN_TOP)
        self.name = ListBox(Height='34px', Width='208px')
        self.name.setStyleName('form-control input-lg')
        self.name.addChangeListener(getattr(self, 'on_milestone_changed'))
       
        for m in milestone_names:
            self.name.addItem(m) 
        if len(self.milestone_dates) > 0:
            self.planned_completion = Label(self.milestone_dates[0])
        else:
            self.planned_completion = Label('Undefined')
            
        self.planned_completion.setStyleName('form-control text-normal')

        self.expected_completion = Report_Date_Field(cal_ID='end')
        self.expected_completion.getTextBox().setStyleName('form-control')
        self.expected_completion.setRegex(DATE_MATCHER)
        self.expected_completion.appendValidListener(self._display_ok)
        self.expected_completion.appendInvalidListener(self._display_error)
        self.expected_completion.validate(None)

        self.hpanel.add(self.name)
        self.hpanel.add(Label(Width='10px'))
        self.hpanel.add(self.planned_completion)
        self.hpanel.add(Label(Width='10px'))
        self.hpanel.add(self.expected_completion)
 def __init__(self, **kwargs):
     DialogWindow.__init__(self, modal=True, close=True)
     v = VerticalPanel()
     v.setWidth(300)
     # v.setHeight(500)
     self.setText("definition")
     self.setPopupPosition(100, 100)
     self.setStyleAttribute("background-color", "#ffffff")
     self.setStyleAttribute("color", "#9847a2")
     self.setStyleAttribute("border-width", "5px")
     self.setStyleAttribute("border-style", "solid")
     h = HorizontalPanel()
     self.textbox_name = TextBox()
     h.add(Label("name"))
     h.add(self.textbox_name)
     v.add(h)
     h = HorizontalPanel()
     self.textbox_scheme = TextBox()
     h.add(Label("print scheme"))
     h.add(self.textbox_scheme)
     v.add(h)
     self.add(v)
     self.theorems = list()
     self.radios = list()
     for t in Theorem.theorems:
         if t.formula.is_in_unique_form():
             self.theorems.append(t)
             self.radios.append(RadioButton("group1", ""))
             h = HorizontalPanel()
             h.add(self.radios[-1])
             im = Image()
             im.setUrl(latex_to_url(t.formula.to_latex()))
             h.add(im)
             v.add(h)
     v.add(Button("Done", self.done_click))
Exemple #4
0
 def __init__(self, start_date, can_delete=True):
     # We need to use old form of inheritance because of pyjamas
     SimplePanel.__init__(self)
     self.vpanel = VerticalPanel()
     desc_panel = VerticalPanel()
     self.desc_box = TextBox()
     self.desc_box.setVisibleLength(44)
     self.desc_box.setStyleName('form-control')
     desc_lbl = Label('impediment description')
     desc_lbl.setStyleName('text-muted')
     desc_panel.add(self.desc_box)
     desc_panel.add(desc_lbl)
     # Set to False if loaded from database
     self.can_delete = can_delete
     
     status_panel = VerticalPanel()
     self.status_lst = ListBox(Height='34px')
     self.status_lst.setStyleName('form-control input-lg')
     self.status_lst.addItem('Open')
     self.status_lst.addItem('Closed')
     # we put date here
     
     self.status_lbl = Label('')
     self.set_start_date(start_date)
     self.status_lbl.setStyleName('text-muted')
     status_panel = VerticalPanel()
     status_panel.add(self.status_lst)
     status_panel.add(self.status_lbl)
     self.comment = Text_Area_Row('', 'why it exists or is being closed')
     hpanel = HorizontalPanel()
     hpanel.add(desc_panel)
     hpanel.add(Label(Width='10px'))
     hpanel.add(status_panel)
     self.vpanel.add(hpanel)
     self.vpanel.add(self.comment.panel())
Exemple #5
0
    def __init__(self):
        SimplePanel.__init__(self)

        self.form = FormPanel()
        self.form.setEncoding(FormPanel.ENCODING_MULTIPART)
        self.form.setMethod(FormPanel.METHOD_POST)
        self.url = "http://localhost/pyjamas_upload_demo"
        self.form.setAction(self.url)
        self.form.setTarget("results")

        vPanel = VerticalPanel()

        hPanel = HorizontalPanel()
        hPanel.setSpacing(5)
        hPanel.add(Label("Upload file:"))

        self.field = FileUpload()
        self.field.setName("file")
        hPanel.add(self.field)

        hPanel.add(Button("Submit", getattr(self, "onBtnClick")))
        vPanel.add(hPanel)

        self.simple = CheckBox("Simple mode?  ")
        #self.simple.setChecked(True)
        vPanel.add(self.simple)
        self.progress = Label('0%')

        results = NamedFrame("results")
        vPanel.add(results)
        vPanel.add(self.progress)

        self.form.add(vPanel)
        self.add(self.form)
Exemple #6
0
    def init_constants_adj_grid(self):
        '''Initializes the grid that allows the TD_CONSTS to be adjusted.
    '''
        self.decr_buttons = {}
        self.adj_learning_labels = {}
        self.adj_static_labels = {}
        self.incr_buttons = {}
        td_keys = ['c1', 'c2', 'c3', 'c4', 'c5', 'c6']

        learning_ai_header = Label("Constant for the learning AI.")
        self.adj_grid.setWidget(0, 0, learning_ai_header)

        static_ai_header = Label("Constants for the static AI.")
        self.adj_grid.setWidget(0, 2, static_ai_header)

        for i, key in enumerate(td_keys):
            j = i + 1  # off by one because of header...
            self.adj_learning_labels[key] = Label(
                "Constant %d: %f" % (key[1], self.TD_CONSTS[key]))
            self.adj_grid.setWidget(j, 0, self.adj_learning_labels[key])

            self.decr_buttons[key] = Button('<', self)
            self.adj_grid.setWidget(j, 1, self.decr_buttons[key])

            self.adj_static_labels[key] = Label("Constant %d: %f" %
                                                (key[1], self.CONSTS[key]))
            self.adj_grid.setWidget(j, 2, self.adj_static_labels[key])

            self.incr_buttons[key] = Button('>', self)
            self.adj_grid.setWidget(j, 3, self.incr_buttons[key])
Exemple #7
0
	def initCompanyGUI(self):
		self.current = self.app.company
	
		self.grid.clear()
		self.grid.resize(4, 3)
		
		# row 1
		self.grid.setWidget(0, 0, Label("Name:"))
		self.grid.setWidget(1, 0, Label("Department:"))
		self.grid.setWidget(2, 0, Label("Total:"))
		
		# row 2
		self.grid.setWidget(0, 1, self.name)
		self.grid.setWidget(1, 1, self.departments)
		self.grid.setWidget(2, 1, self.total)

		# row 3
		self.grid.setWidget(0, 2, self.save)
		self.grid.setWidget(1, 2, self.selectDepartment)
		self.grid.setWidget(2, 2, self.cut)
		
		self.name.setText(self.current.name)
		self.departments.clear()
		for item in self.current.departments:
			self.departments.addItem(item.name, item.id)
		if self.departments.getItemCount() > 0:
			self.departments.setSelectedIndex(0)
		self.total.setText(self.current.total())
Exemple #8
0
        def validateEmployee(self, index, name, address, salary):
                valid = True

                if name == "":
                        self.errors.add(Label("- Enter a valid name, please."))
                        valid = False

                if address == "":
                        self.errors.add(Label("- Enter a valid address, please."))
                        valid = False

                if salary == "":
                        self.errors.add(Label("- Enter a valid salary, please."))
                        valid = False

                try:
                        float(salary)
                except ValueError:
                        self.errors.add(Label("- The salary must be a number. Enter a valid salary, please."))
                        valid = False
                        
                
                for item in self.app.employees:
                        if item.id != index and name == item.name and item.address == address:
                                self.errors.add(Label("- There is already an employee with the same name and address combination. Enter a valid name and address, please."))
                                valid = False
                return valid
Exemple #9
0
    def __init__(self):
        SimplePanel.__init__(self)

        panel = VerticalPanel(BorderWidth=1,
                              HorizontalAlignment=HasAlignment.ALIGN_CENTER,
                              VerticalAlignment=HasAlignment.ALIGN_MIDDLE,
                              Width="50%",
                              Height="300px")

        part1 = Label("Part 1")
        part2 = Label("Part 2")
        part3 = Label("Part 3")
        part4 = Label("Part 4")

        panel.add(part1)
        panel.add(part2)
        panel.add(part3)
        panel.add(part4)

        panel.setCellHeight(part1, "10%")
        panel.setCellHeight(part2, "70%")
        panel.setCellHeight(part3, "10%")
        panel.setCellHeight(part4, "10%")

        panel.setCellHorizontalAlignment(part3, HasAlignment.ALIGN_RIGHT)

        self.add(panel)
Exemple #10
0
    def __init__(self, row, column=0):
        super(Game, self).__init__(StyleName='game')
        self.sinkEvents(Event.ONCONTEXTMENU)  # to disable right click

        self.row = row
        self.column = column or row
        self.level = 1
        self.toppers = [[], [], []]  # storage for top scorers for 3 levels.
        self.remote = DataService()
        self.remote_handler = RemoteHandler(self)
        self.remote.get_scores(self.remote_handler)

        # contents of Game
        menubar = MineMenuBar(self)
        score_board = HorizontalPanel(StyleName='score-board')
        self.grid_panel = SimplePanel(StyleName='grid-panel')

        self.add(menubar)
        self.add(score_board)
        self.add(self.grid_panel)

        # contents of score_board
        self.counter = Label('000', StyleName='digit counter')
        self.face = Smiley(self)
        self.timer = Label('000', StyleName='digit timer')

        for one in (self.counter, self.face, self.timer):
            score_board.add(one)
        score_board.setCellWidth(self.face, '100%')

        self.create_grid()
        self.start()
Exemple #11
0
 def __init__(self, key, title, content):
     AbsolutePanel.__init__(self)
     self.edit_header = Label("Edit a Post", StyleName="header_label")
     self.edit_title_label = Label("Title:")
     self.edit_title = TextBox()
     self.edit_title.setMaxLength(255)
     self.edit_content = TextArea()
     self.edit_content.setVisibleLines(2)
     self.edit_button = Button("Save")
     self.edit_cancel_button = Button("Cancel")
     self.edit_hidden_key = Hidden()
     self.error_message_label = Label("", StyleName="error_message_label")
     edit_contents = VerticalPanel(StyleName="Contents", Spacing=4)
     edit_contents.add(self.edit_header)
     edit_contents.add(self.edit_title_label)
     edit_contents.add(self.edit_title)
     edit_contents.add(self.edit_content)
     edit_contents.add(self.edit_button)
     edit_contents.add(self.edit_cancel_button)
     edit_contents.add(self.error_message_label)
     edit_contents.add(self.edit_hidden_key)
     self.edit_dialog = DialogBox(glass=True)
     self.edit_dialog.setHTML('<b>Blog Post Form</b>')
     self.edit_dialog.setWidget(edit_contents)
     left = (Window.getClientWidth() - 900) / 2 + Window.getScrollLeft()
     top = (Window.getClientHeight() - 600) / 2 + Window.getScrollTop()
     self.edit_dialog.setPopupPosition(left, top)
     self.edit_dialog.hide()
Exemple #12
0
 def addline(line):
     global curgroup, curgroupwidgets, curgrouphead, fp
     line = line.strip()
     line = line.replace("->", RARROW)
     if line.startswith("Installing "):
         # New group: 1
         if curgroup != 1: finishgroup()
         curgroup = 1
         curgroupwidgets.append(Label(line))
     elif line.startswith(RARROW):
         # New group: 2.
         if curgroup == 0:
             # The last line is still stored in curgroupwidgets. We use
             # it as the DisclosurePanel head.
             assert curgrouphead == None
             if curgroupwidgets == []:
                 curgrouphead = "unknown reduction"
             else:
                 assert len(curgroupwidgets) == 1
                 curgrouphead = curgroupwidgets[0].getText()
                 curgroupwidgets = []
         elif curgroup != 2:
             finishgroup()
         curgroup = 2
         curgroupwidgets.append(Label(line))
         # Window.alert(curgroupwidgets)
     else:
         # New group: 0
         finishgroup()
         curgroup = 0
         curgroupwidgets = [Label(line)]
Exemple #13
0
    def __init__(self):
        SimplePanel.__init__(self)

        panel = VerticalPanel()
        panel.setBorderWidth(1)

        panel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER)
        panel.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)

        part1 = Label("Part 1")
        part2 = Label("Part 2")
        part3 = Label("Part 3")
        part4 = Label("Part 4")

        panel.add(part1)
        panel.add(part2)
        panel.add(part3)
        panel.add(part4)

        panel.setCellHeight(part1, "10%")
        panel.setCellHeight(part2, "70%")
        panel.setCellHeight(part3, "10%")
        panel.setCellHeight(part4, "10%")

        panel.setCellHorizontalAlignment(part3, HasAlignment.ALIGN_RIGHT)

        panel.setWidth("50%")
        panel.setHeight("300px")

        self.add(panel)
Exemple #14
0
 def onModuleLoad(self):
     
     self.remote_py = MyBlogService()
     
     # Create a FormPanel and point it at a service.
     self.form = FormPanel()
     
     # Create a panel to hold all of the form widgets.
     vp=VerticalPanel(BorderWidth=0,HorizontalAlignment=HasAlignment.ALIGN_CENTER,VerticalAlignment=HasAlignment.ALIGN_MIDDLE,Width="100%",Height="150px")
     self.form.setWidget(vp)
     
     header=HTML("<h2>LOGIN TO YOUR ACCOUNT</h2>")
     part1=header
           
     # Create a TextBox, giving it a name so that it will be submitted.
     self.userName = TextBox()
     self.userName.setName("userNameFormElement")
     self.userName.setPlaceholder("User Name")
     part2=self.userName
     
     self.password = PasswordTextBox()
     self.password.setName("passwordFormElement")
     self.password.setPlaceholder("Password")
     part3=self.password
     
     self.errorInfoLabel = Label()
     self.errorInfoLabel.setStyleName('error-info')
     part4=self.errorInfoLabel
     part4.setStyleName("errorlabel")
     
      # Add a 'submit' button.
     hpanel = HorizontalPanel(BorderWidth=0,HorizontalAlignment=HasAlignment.ALIGN_CENTER,VerticalAlignment=HasAlignment.ALIGN_MIDDLE,Width="100%",Height="50px")
     
     partb=Button("Login", self)
     partb.setStyleName('btn')
     
     image=Label("Don''t have account? Sign up")
     anchor = Anchor(Widget=image, Href='/signup.html')
     parta=anchor
     
          
     hpanel.add(partb)
     hpanel.add(parta)
    
     part5=hpanel 
     part5.setStyleName("hpanel")
     
     vp.add(part1)
     vp.add(part2)
     vp.add(part3)
     vp.add(part4)
     vp.add(part5)
     vp.setStyleName("signup")
     
     # Add an event handler to the form.
     self.form.addFormHandler(self)
     RootPanel().add(self.form)
Exemple #15
0
	def validateDepartment(self, index, name):
                valid = True

                if name == "":
                        self.errors.add(Label("- Enter a valid name, please."))
                        valid = False
                
                for item in self.app.departments:
                        if item.id != index and name == item.name:
                                self.errors.add(Label("- There is already a department with the same name. Enter a valid name, please."))
                                valid = False
                return valid
Exemple #16
0
    def __init__(self):
        self.average = 1
        self.iterations = 1
        self.startTime = -1

        self.refreshRateLabel = Label("")
        self.averageLabel = Label("")

        layout = VerticalPanel()
        layout.add(self.refreshRateLabel)
        layout.add(self.averageLabel)

        Composite.__init__(self, layout)
Exemple #17
0
    def __init__(self):
        # We need to use old form of inheritance because of pyjamas
        SimplePanel.__init__(self)
        self.hpanel = HorizontalPanel(Width='755px')
        self.hpanel.setVerticalAlignment(HasAlignment.ALIGN_TOP)
        
        self.name = TextBox()
        self.name.setStyleName('form-control')

        self.start = Report_Date_Field(cal_ID='start')
        
        self.start.getTextBox().setStyleName('form-control')
        self.start.setRegex(DATE_MATCHER)
        self.start.appendValidListener(self._display_ok)
        self.start.appendInvalidListener(self._display_error)
        self.start.validate(None)

        self.end = Report_Date_Field(cal_ID='end')
        self.end.getTextBox().setStyleName('form-control')
        self.end.setRegex(DATE_MATCHER)
        self.end.appendValidListener(self._display_ok)
        self.end.appendInvalidListener(self._display_error)
        self.end.validate(None)

        self.status = ListBox()
        self.status.addItem('Active')
        self.status.addItem('Inactive')
        self.status.setVisibleItemCount(0)
        self.status.setStyleName('form-control input-lg')
        self.status.setSize('100px', '34px')
        
        spacer1 = Label(Width='10px')
        spacer2 = Label(Width='10px')
        spacer3 = Label(Width='10px')

        self.add_btn = Button('Add')
        self.add_btn.setStyleName('btn btn-primary')
        self.del_btn = Button('Delete')
        self.del_btn.setStyleName('btn btn-danger')

        self.hpanel.add(self.name)
        self.hpanel.add(spacer1)
        self.hpanel.add(self.status)
        self.hpanel.add(spacer2)
        self.hpanel.add(self.start)
        #self.hpanel.add(spacer3)
        self.hpanel.add(self.end)
        self.hpanel.add(self.add_btn)
        self.hpanel.add(Label(Width='10px'))
        self.hpanel.add(self.del_btn)
Exemple #18
0
    def __init__(self, name, widget, help=''):
        SimplePanel.__init__(self)
        # Container
        self.mainpanel = VerticalPanel()

        self.lbl = Label(name)
        self.hlp = Label(help)
        self.lbl.setStyleName('h3')
        self.hlp.setStyleName('text-muted')
        
        self.wdg = widget
        self.mainpanel.add(self.lbl)
        self.mainpanel.add(self.wdg)
        self.mainpanel.add(self.hlp)
Exemple #19
0
    def __init__(self):
        # We need to use old form of inheritance because of pyjamas
        SimplePanel.__init__(self)
        self.hpanel = HorizontalPanel(Width='475px')
        self.hpanel.setVerticalAlignment(HasAlignment.ALIGN_BOTTOM)
        
        self.name = TextBox()
        self.name.setStyleName('form-control')
        
        self.status = ListBox()
        self.status.addItem('Active')
        self.status.addItem('Inactive')
        self.status.setVisibleItemCount(0)
        self.status.setStyleName('form-control input-lg')
        self.status.setSize('100px', '34px')
        
        lbl = Label('', Width='10px')

        self.add_btn = Button('Add')
        self.add_btn.setStyleName('btn btn-primary')
        self.del_btn = Button('Delete')
        self.del_btn.setStyleName('btn btn-danger')

        self.hpanel.add(self.name)
        self.hpanel.add(lbl)
        self.hpanel.add(self.status)
        self.hpanel.add(self.add_btn)
        self.hpanel.add(self.del_btn)
Exemple #20
0
    def __init__(self):

        # create the label and slider
        self.__label = Label('OFF')
        self.slider = slider = HorizontalSlider(0,
                                                5,
                                                step=1,
                                                StyleName="slider")
        slider.setDragable(True)
        slider.addControlValueListener(self)

        # put them in a hpanel
        self.hpanel = hpanel = HorizontalPanel(Spacing=10)
        hpanel.add(slider)
        hpanel.add(self.__label)

        # create the color panel and give it color
        self.colorpanel = CaptionPanel('Color:',
                                       SimplePanel(StyleName='colorpanel'))
        self.randomcolor()

        # we're initially off
        self.value = 0
        # create our timer
        self.timer = Timer(notify=self)
Exemple #21
0
    def onModuleLoad(self):

        self.label = Label("Not set yet")

        self.button = Button("Probe button", self)
        self.image_up = Image("./images/logo.png")
        self.image_up3 = Image("./images/logo.png")
        self.image_down = Image("./images/logo.png")
        self.image_down3 = Image("./images/logo.png")
        self.toggle = ToggleButton(self.image_up, self.image_down, self)
        self.toggle2 = ToggleButton("up", "down", getattr(self, "onToggleUD"))
        self.push = PushButton(self.image_up3, self.image_down3)

        self.vpanel = VerticalPanel()
        self.togglePanel = HorizontalPanel()
        self.togglePanel.setSpacing(10)

        self.togglePanel.add(self.toggle)
        self.togglePanel.add(self.toggle2)
        self.togglePanel.add(self.push)

        self.vpanel.add(self.label)
        self.vpanel.add(self.button)
        self.vpanel.add(self.togglePanel)

        RootPanel().add(self.vpanel)
        self.i = False
Exemple #22
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)
Exemple #23
0
  def __init__(self):
    AbsolutePanel.__init__(self)

    StyleSheetCssText(margins) # initialize css...

    header = """<div><H2 align="center">Welcome to Unbeatable Tic-Tac-Toe!</H2><br>My <a href="https://github.com/chetweger/min-max-games/blob/master/ttt/ttt.py">implementation</a> uses the min-max search algorithm with alpha beta pruning and a transposition table!</div>"""
    header = HTML(header, StyleName='margins_both')
    self.add(header)

    self.ai_first = Button("AI first.", self, StyleName='margins_left')
    self.add(self.ai_first)

    self.new_game = Button("New game", self, StyleName='margins_left')
    self.add(self.new_game)

    self.g=Grid(StyleName='margins_left')
    self.g.resize(3, 3)
    self.g.setBorderWidth(2)
    self.g.setCellPadding(4)
    self.g.setCellSpacing(1)

    self.init()
    self.add(self.g)

    self.state = State()

    self.game_resolution=Label("", StyleName='margins_left')
    self.add(self.game_resolution)
Exemple #24
0
    def __init__(self):
        SimplePanel.__init__(self)

        self.form = FormPanel()
        self.form.setEncoding(FormPanel.ENCODING_MULTIPART)
        self.form.setMethod(FormPanel.METHOD_POST)
        self.form.setAction("http://nonexistent.com")
        self.form.setTarget("results")

        vPanel = VerticalPanel()

        hPanel = HorizontalPanel()
        hPanel.setSpacing(5)
        hPanel.add(Label("Upload file:"))

        self.field = FileUpload()
        self.field.setName("file")
        hPanel.add(self.field)

        hPanel.add(Button("Submit", getattr(self, "onBtnClick")))

        vPanel.add(hPanel)

        results = NamedFrame("results")
        vPanel.add(results)

        self.form.add(vPanel)
        self.add(self.form)
Exemple #25
0
    def __init__(self, chart):
        self.chart = chart
        self.canvas = chart.canvas

        self.b2 = Button("Compositing", self)
        self.b3 = Button("Paths & shapes", self)
        self.b4 = Button("Arcs & circles", self)
        self.b1 = Button("Bezier curves", self)
        self.b6 = Button("Colors", self)
        self.b7 = Button("Translating", self)
        self.b8 = Button("Scaling", self)
        self.b5 = Button("Rotating", self)
        self.b10 = Button("Transparency", self)
        self.b11 = Button("Lines", self)
        self.b9 = Button("Animations", self)

        hp = HorizontalPanel()
        vp = VerticalPanel()
        vp.setHorizontalAlignment(HasAlignment.ALIGN_LEFT)
        vp.add(Label("MENU"))
        vp.setSpacing(6)
        vp.add(self.b2)
        vp.add(self.b3)
        vp.add(self.b4)
        vp.add(self.b1)
        vp.add(self.b6)
        vp.add(self.b7)
        vp.add(self.b8)
        vp.add(self.b5)
        vp.add(self.b10)
        vp.add(self.b11)
        vp.add(self.b9)
        hp.add(vp)

        Composite.__init__(self, hp)
 def __init__(self):
     HorizontalPanel.__init__(self, StyleName="type_block select_block")
     self.add(Label('Tipo:'))       
     
     fake = Element(Element=DOM.createDiv())
     
     self.booleanBlock = getattr(ArduinoBlocks, 'logicType')('logica', 'red', off=True)
     fake.append(self.booleanBlock)
     self.logicType = RadioButton("group1", fake.getElement().innerHTML, True)
     self.logicType.addClickListener(getattr(self, "onClickLogicType"))
     self.add(self.logicType)
     fake.removeAll()
     
     self.numberBlock = getattr(ArduinoBlocks, 'numericType')('numerica', 'red', off=True)
     fake.append(self.numberBlock)
     self.numericType = RadioButton("group1", fake.getElement().innerHTML, True)
     self.numericType.setChecked(True)
     self.numericType.addClickListener(getattr(self, "onClickNumericType"))
     self.add(self.numericType)
     fake.removeAll()
     
     self.stringBlock = getattr(ArduinoBlocks, 'alphaNumericType')('alfanumerica', 'red', off=True)
     fake.append(self.stringBlock)
     self.alphaNumericType = RadioButton("group1", fake.getElement().innerHTML, True)
     self.alphaNumericType.addClickListener(getattr(self, "onClickAlphanumericType"))
     self.add(self.alphaNumericType)
     
     self.onClickNumericType()
Exemple #27
0
    def __init__(self, left=50, top=50):
        DialogBox.__init__(self, modal=False)

        self.setPopupPosition(left, top)
        self.setText("Preferences")
        ftable = FlexTable()
        ftableFormatter = ftable.getFlexCellFormatter()
        row = 0

        try:
            self.fileLocation = getCookie("fileLocation")
        except:
            self.fileLocation = None

        row += 1
        ftable.setWidget(row, 0,
                         Label("Sheet loaded on startup", wordWrap=False))
        self.fileLocationInput = TextBox()
        self.fileLocationInput.addChangeListener(self.checkValid)
        self.fileLocationInput.addKeyboardListener(self)
        self.fileLocationInput.setVisibleLength(30)
        self.fileLocationInput.setText(self.fileLocation)
        ftable.setWidget(row, 1, self.fileLocationInput)

        row += 1
        hpanel = HorizontalPanel()
        self.saveBtn = Button("Save", self.onSave)
        self.saveBtn.setEnabled(False)
        hpanel.add(self.saveBtn)
        self.cancelBtn = Button("Cancel", self.onCancel)
        hpanel.add(self.cancelBtn)
        ftable.setWidget(row, 0, hpanel)
        ftableFormatter.setColSpan(row, 0, 2)

        self.setWidget(ftable)
Exemple #28
0
 def addDropWidget(self):
     s = len(self.children)
     w = Label(Element=DOM.createElement('li'))
     w.setID('effectdrop' + str(s))
     w.setStyleName('drophere')
     w.setText('Drop %s (%s)' % (s, self.data[s]))
     self.append(w)
    def __init__(self):
        """ Constructs a new EditPanel.
        """
        self.TEXT_WAITING = "Waiting for response..."
        self.TEXT_ERROR = "Server Error"

        #        self.remote_py = RegionNamesServicePython()

        self.panel = VerticalPanel()

        top_panel = HorizontalPanel()
        top_panel.setSpacing(8)
        self.panel.add(top_panel)

        refresh = Button("Refresh", self)
        top_panel.add(refresh)

        self.status = Label()
        top_panel.add(self.status)

        edit_panel = HorizontalPanel()
        self.panel.add(edit_panel)

        self.tree = Tree()
        self.tree.addTreeListener(self)
        edit_panel.add(self.tree)

        upload_item = TreeItem("Upload")
        self.tree.add(upload_item)
        map_item = TreeItem("Map")
        self.tree.add(map_item)
Exemple #30
0
    def updatePageDisplay(self):
        self.g.removeFromParent()
        self.g = Grid()
        self.g.setStyleName('content-style')
        self.g.addTableListener(self)
        for y in range(len(self.blogs)):
            for x in range(1):
                json_data = json.loads(self.blogs[y])
                blogPanel = VerticalPanel()
                blogTitleAnchor = Anchor(Widget=HTML('%s' %
                                                     json_data["blog_name"]),
                                         Href='/blogdetail.html')
                blogTitleAnchor.setStyleName('blog-search-title')
                blogPanel.add(blogTitleAnchor)
                blogDetails = Label()
                blogDetails.setStyleName('blog-details')

                blogContent = json_data["blog_content"]
                if len(blogContent) > 200:
                    blogContent = blogContent[0:200] + '......'

                blogDetails.setText('%s' % (blogContent))
                blogPanel.add(blogDetails)

                self.g.add(blogPanel, y, x)

        self.absolultutePanel.add(self.g)