Ejemplo n.º 1
0
	def StartButtonPressed(self):	   
		self.CountTurn = 1
		if int(self.PlayerNum.getText()) >= 2 and int(self.PlayerNum.getText()) <= 6 and int(self.WinScore.getText()) >= 10 and int(self.WinScore.getText()) <= 100:	        
			self.DPanel.remove(self.TxtInstructions, DockPanel.CENTER)
			self.BankButton.setVisible(True)
			self.RollButton.setVisible(True)
			# self.image.setVisible(True)
			self.TempBoard.setVisible(True)
			self.NameScore.setVisible(True)
			self.image = Image( self.DummyUrl + "images/0.png")
			self.image.setSize("200px", "300px")
			self.DPanel.add(self.image, DockPanel.CENTER)
			RootPanel().add(self.DPanel)
			self.StartButton.setEnabled(False)
			self.PlayerNum.setEnabled(False)
			self.WinScore.setEnabled(False)
			self.RollButton.setEnabled(True)
			self.TempBoard.setText(1,0,"Player"+str(1))
			self.TempBoard.setText(1, 1, "0")
			self.NameScore.getRowFormatter().addStyleName(self.CountTurn,"Rows")
		else:
			Window.alert("Please Enter Correct Parameters " ) #Command for alert window
			return 0
		VarPlayer = ["Player" + str(i) for i in xrange(1,int(self.PlayerNum.getText())+1)]
		i = 0
		while i < int(self.PlayerNum.getText()):
			self.NameScore.setText(i+1, 0, VarPlayer[i])
			self.NameScore.setText(i+1, 1, "0")
			self.VarTotScore.append(0) #m*1 vector of zeros indicating the initial scores 
			i += 1
Ejemplo n.º 2
0
    def __init__(self):
        Sink.__init__(self)
        self.curImage=0
        self.image=Image()
        self.loadingImage = Image(self.baseURL() + "images/blanksearching.gif")
        self.nextButton = Image(self.baseURL() + "rembrandt/forward.gif")
        self.prevButton = Image(self.baseURL() + "rembrandt/back.gif")
        self.sImages=["rembrandt/JohannesElison.jpg", "rembrandt/LaMarcheNocturne.jpg", "rembrandt/SelfPortrait1628.jpg", "rembrandt/SelfPortrait1640.jpg", "rembrandt/TheArtistInHisStudio.jpg", "rembrandt/TheReturnOfTheProdigalSon.jpg"]

        for i in range(len(self.sImages)):
            self.sImages[i]=self.baseURL() + self.sImages[i]
        
        self.image.addLoadListener(self)
        self.prevButton.addClickListener(self)
        self.nextButton.addClickListener(self)
        
        topPanel = DockPanel()
        topPanel.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)
        topPanel.add(self.prevButton, DockPanel.WEST)
        topPanel.add(self.nextButton, DockPanel.EAST)
        topPanel.add(self.loadingImage, DockPanel.CENTER)
        
        panel = VerticalPanel()
        panel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER)
        panel.add(HTML("<h2>A Bit of Rembrandt</h2>", True))
        panel.add(topPanel)
        panel.add(self.image)
        
        panel.setWidth("100%")
        self.initWidget(panel)
        self.image.setStyleName("ks-images-Image")
        self.nextButton.setStyleName("ks-images-Button")
        self.prevButton.setStyleName("ks-images-Button")
        
        self.loadImage(0)           
Ejemplo n.º 3
0
	def StillImage(self):
		self.DPanel.remove(self.image, DockPanel.CENTER)
		self.image = Image( self.DummyUrl + "images/" +str(self.DiceInstance)+".png")
		self.image.setSize("300px", "300px")
		self.DPanel.add(self.image, DockPanel.CENTER)
		self.DPanel.setCellHeight(self.image, "300px")
		self.DPanel.setCellWidth(self.image, "600px")
		RootPanel().add(self.DPanel)
		self.timer.cancel()
		if self.DiceInstance != 1: 
			self.TempBoard.setText(1, 1, self.DiceInstance + int(self.TempBoard.getText(1, 1))) 
			self.BankButton.setEnabled(True)
			self.RollButton.setEnabled(True)
		else:
			self.NameScore.getRowFormatter().removeStyleName(self.CountTurn,"Rows")
			self.RollButton.setEnabled(False)
			self.timerRButton.schedule(1500)
			self.CountTurn += 1
			if self.CountTurn % int(self.PlayerNum.getText()) == 1:
				self.CountTurn = 1
				self.TempBoard.setText(1,0,"Player"+str(self.CountTurn))
				self.TempBoard.setText(1, 1, "0")
				self.NameScore.getRowFormatter().addStyleName(self.CountTurn,"Rows");
			else:
				self.TempBoard.setText(1,0,"Player"+str(self.CountTurn))
				self.TempBoard.setText(1, 1, "0")
				self.NameScore.getRowFormatter().addStyleName(self.CountTurn,"Rows");
Ejemplo n.º 4
0
class MechDrawing(VerticalPanel):
    def __init__(self, handle, idx, image, variables = None, code = None, 
                 perspective = '', checkOptions = [False, True]):
        VerticalPanel.__init__(self)
        self._handle = handle
        self.idx = idx
        # set style
        self.setStyleName('os-mech-drawing')  
        # create widgets
        self._img = Image(image)
        self._img.setStyleName('os-mech-thumb')
        self._img.addClickListener(self.onClickDrawing)
        self._perspective = '%d - %s'%(idx, perspective.capitalize())
        self._optionPanel = MechOptionPanel(handle, idx, checkOptions)
        textArea  = TextArea(code)
        textArea.setText(code)
        textArea.setStyleName('os-mech-code-locked')
        textArea.setReadonly(self, True)
        # populate drawing
        self.add(self._img)
        self.add(self._optionPanel)
        self.add(textArea)
    def actRatioChange(self, ratio):
        self._optionPanel.actRatioChange(ratio)
    def onClickDrawing(self, sender, event):
        Window.open(self._img.getUrl() + '&render=html&title=%s'%self._perspective, self._perspective, "status=1,resizeable=1,scrollbars=1")
Ejemplo n.º 5
0
 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))
Ejemplo n.º 6
0
    def refresh_theorems(self, folder):
        self.remove_images()

        def onClick(theorem):
            def name(n):
                return "var" + str(n + 1)

            def print_scheme(n):
                return ["\\alpha", "\\beta", "\\gamma", "\\delta", "\\epsilon"][n]

            def poas(sender):
                if len(theorem.operations) == 1:
                    constants = [Operation("const" + str(i + 1), 0, print_scheme(i), name(i), Operation.EXPRESSION)
                                 for i in range(theorem.operations[0].no_of_args)]

                    def after1(f):
                        self.after(
                            theorem.formula.substitute_definition(Formula([theorem.operations[0]] + constants), f),
                            predecessors=[], rule_name="insert")

                    request_formula([op for op in proof.get_operations()] + constants,
                                    after1, type=('rel' if theorem.operations[0].type == Operation.RELATION else 'exp'))
                else:
                    self.after(theorem.formula, predecessors=[], rule_name="insert")

            return poas

        for ax in [x for x in Theorem.theorems if x.folder == folder]:
            im = Image()
            im.addClickListener(onClick(ax))
            im.setUrl(latex_to_url(ax.formula.to_latex()))
            self.pok.add(im)
            self.images.append(im)
Ejemplo n.º 7
0
    def __init__(self, theorem, **kwargs):
        DialogWindow.__init__(self, modal=True, close=True)
        self.theorem = theorem
        v = VerticalPanel()
        v.setWidth(300)
        # v.setHeight(500)
        self.setText("save")
        self.setPopupPosition(100, 100)
        self.setStyleAttribute("background-color", "#ffffff")
        self.setStyleAttribute("color", "red")
        self.setStyleAttribute("border-width", "5px")
        self.setStyleAttribute("border-style", "solid")
        self.im = Image()
        self.im.setUrl(latex_to_url(self.theorem.formula.to_latex()))
        v.add(self.im)
        h = HorizontalPanel()
        self.radio = RadioButton("group1", "Existing folder:")
        h.add(self.radio)
        self.list = ListBox()
        self.list.setVisibleItemCount(1)
        for f in Theorem.get_all_folders():
            self.list.addItem(f)

        h.add(self.list)
        v.add(h)
        h = HorizontalPanel()
        h.add(RadioButton("group1", "New folder:"))
        self.radio.setChecked(True)
        self.textbox = TextBox()
        h.add(self.textbox)
        v.add(h)
        v.add(Button("Done", self.done_click))
        self.add(v)
Ejemplo n.º 8
0
    def __init__(self, operations,after,type='rel'):
        DialogWindow.__init__(self, modal=True, close=True)
        self.formula = Formula([])
        self.after=after

        left = 100
        top = 100

        self.ops_with_buttons = [{"op": op, "button": Button(op.name, self)} for op in operations if op.available]
        dock = DockPanel()
        dock.setSpacing(3)

        for owb in self.ops_with_buttons:
            dock.add(owb['button'], DockPanel.NORTH)

        dock.setWidth("300")

        self.image = Image(latex_to_url(self.formula.fill_with_placeholders().to_latex()))
        dock.add(self.image, DockPanel.EAST)
        dock.setCellHorizontalAlignment(self.image, HasAlignment.ALIGN_TOP)

        self.doneButton=Button("Done",self)
        self.doneButton.setEnabled(False)
        dock.add(self.doneButton,DockPanel.SOUTH)

        dock.add(HTML(""),DockPanel.CENTER)

        self.setText("opkop")
        self.setPopupPosition(left, top)
        self.setStyleAttribute("background-color", "#ffffff")
        self.setStyleAttribute("color", "blue")
        self.setStyleAttribute("border-width", "5px")
        self.setStyleAttribute("border-style", "solid")

        self.setWidget(dock)
Ejemplo n.º 9
0
    def set_styles(self):
        self.dock = DockPanel()
        self.dock.setSpacing(3)

        self.dock.setWidth("300")

        self.image = Image(
            latex_to_url(self.formula.fill_with_placeholders().to_latex()))
        self.dock.add(self.image, DockPanel.EAST)
        self.dock.setCellHorizontalAlignment(self.image,
                                             HasAlignment.ALIGN_TOP)

        self.backspaceButton_add()
        self.doneButton_add()

        self.dock.add(HTML(""), DockPanel.CENTER)
        left = 100
        top = 100

        self.setText("opkop")
        self.setPopupPosition(left, top)
        self.setStyleAttribute("background-color", "#ffffff")
        self.setStyleAttribute("color", "blue")
        self.setStyleAttribute("border-width", "5px")
        self.setStyleAttribute("border-style", "solid")

        self.setWidget(self.dock)
Ejemplo n.º 10
0
    def __init__(self):

        Sink.__init__(self)

        self.formula = AX_REG
        self.image1 = Image(latex_to_url(self.formula.fill_with_placeholders().to_latex()))
        self.cnf=self.formula.simplify().to_cnf()
        self.image2 = Image(latex_to_url(self.cnf.to_latex()))
        self.vars=self.cnf.get_vars()

        self.vars_with_proto = [{"var": var, "proto": Proto(var.name)} for var in self.vars]
        self.fProto = [
            Proto("Beethoven", [x["proto"] for x in self.vars_with_proto])
        ]

        self.fTree = Tree()

        for i in range(len(self.fProto)):
            self.createItem(self.fProto[i])
            self.fTree.addItem(self.fProto[i].item)

        self.fTree.addTreeListener(self)

        self.panel = HorizontalPanel(VerticalAlignment=HasAlignment.ALIGN_TOP)
        self.panel.setSpacing(40)
        self.panel.add(self.fTree)

        self.panel.add(self.image1)
        self.panel.add(self.image2)

        self.initWidget(self.panel)
Ejemplo n.º 11
0
 def addToggleButton(self, panel, imagep, tip):
     img = Image(imagep)
     img.setWidth("20px")
     img.setHeight("20px")
     tb = ToggleButton(img)
     self.addAnyButton(panel, tb, tip)
     return tb
Ejemplo n.º 12
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
Ejemplo n.º 13
0
    def __init__(self):
        Algorithm.__init__(self)
	self.MLAlgorithmService = MLAlgorithmService(self)
        self.image=Image(self.baseURL() + "services/kMeansPictures/lenna.png",Width="320px", Height="360px")
        self.resultImage=Image("",Width="320px", Height="360px")
        self.loadingImage = Image(self.baseURL() + "images/blanksearching.gif")
        self.calculateButton = Button("RUN", self.onButtonClick)
        self.log = Button("SHOW LOG", self.openLogFile)
        self.log.setEnabled(False)

        self.image.addLoadListener(self)
        
        topPanel = DockPanel()
        topPanel.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)
        topPanel.add(self.calculateButton, DockPanel.WEST)
        topPanel.add(self.loadingImage, DockPanel.CENTER)
        topPanel.add(self.log, DockPanel.EAST)
        
        panel = DockPanel()
        panel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER)
        panel.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)
        #panel.add(HTML("<h2>Image compression</h2>", True))
        panel.add(topPanel, DockPanel.NORTH)
        panel.add(self.image, DockPanel.WEST)
        panel.add(self.resultImage, DockPanel.EAST)
        
        panel.setWidth("100%")
        self.initWidget(panel)
        self.image.setStyleName("ks-images-Image")
        self.calculateButton.setStyleName("ks-images-Button")
        
        self.loadImage("picturem.png")
Ejemplo n.º 14
0
	def BankButtonPressed(self):
		self.BankButton.setEnabled(False)
		self.NameScore.setText(self.CountTurn, 1,
			int(self.NameScore.getText(self.CountTurn, 1)) + int(self.TempBoard.getText(1,1)))
		if int(self.NameScore.getText(self.CountTurn, 1)) >= int(self.WinScore.getText()):
			AlrtTxt = "Congratulation!!! Player"+ str(self.CountTurn)  + " wins !!!!"
			Window.alert(AlrtTxt)

			self.DPanel.remove(self.image, DockPanel.CENTER)
			self.DPanel.add(self.TxtInstructions, DockPanel.CENTER)
			self.BankButton.setVisible(False)
			self.RollButton.setVisible(False)
			# self.image.setVisible(False)
			self.TempBoard.setVisible(False)
			self.NameScore.setVisible(False)

			i = int(self.PlayerNum.getText())
			while i > 0:
				self.NameScore. removeRow(i)
				i -= 1


			self.TempBoard.setText(1,0,"X")
			self.TempBoard.setText(1, 1, "0")
			self.StartButton.setEnabled(True)
			# self.OK.setEnabled(True)
			self.PlayerNum.setEnabled(True)
			self.WinScore.setEnabled(True)
			self.RollButton.setEnabled(False)
			self.BankButton.setEnabled(False)
			self.NameScore.getRowFormatter().removeStyleName(self.CountTurn,"Rows");




			self.DPanel.remove(self.image, DockPanel.CENTER)
			self.image = Image( self.DummyUrl + "images/0.png")
			self.image.setSize("200px", "300px")
			self.DPanel.add(self.image, DockPanel.CENTER)
			self.DPanel.setCellHeight(self.image, "200px")    
			self.DPanel.setCellWidth(self.image, "400px")




			RootPanel().add(self.DPanel)

		else:
			self.NameScore.getRowFormatter().removeStyleName(self.CountTurn,"Rows");
			self.CountTurn += 1
			if self.CountTurn % int(self.PlayerNum.getText()) == 1:
				self.CountTurn = 1
				self.TempBoard.setText(1,0,"Player"+str(self.CountTurn))
				self.TempBoard.setText(1, 1, "0")
				self.NameScore.getRowFormatter().addStyleName(self.CountTurn,"Rows");
			else:
				self.TempBoard.setText(1,0,"Player"+str(self.CountTurn))
				self.TempBoard.setText(1, 1, "0")
				self.NameScore.getRowFormatter().addStyleName(self.CountTurn,"Rows");
Ejemplo n.º 15
0
    def addPushButton(self, panel, imagep, tip):
        img = Image(imagep)
        img.setWidth("20px")
        img.setHeight("20px")

        pb = PushButton(img)
        self.addAnyButton(panel, pb, tip)
        return pb
Ejemplo n.º 16
0
 def __init__(self, no, up_img, down_img):
     self.x = 0
     self.y = 0
     self.no = no
     self.up_img = up_img
     self.down_img = down_img
     Image.__init__(self, up_img)
     self.setStyleName("gwt-Image-Cell")
Ejemplo n.º 17
0
Archivo: image.py Proyecto: Afey/pyjs
    def __init__(self):
        SimplePanel.__init__(self)

        # We display the "myImage.jpg" file, stored in the "public/images"
        # directory, where "public" is in the application's source directory.

        img = Image("images/myImage.jpg")
        img.addClickListener(getattr(self, "onImageClicked"))
        self.add(img)
Ejemplo n.º 18
0
Archivo: Tabs.py Proyecto: Afey/pyjs
    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
Ejemplo n.º 19
0
    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
Ejemplo n.º 20
0
    def __init__(self):
        SimplePanel.__init__(self)

        # We display the "myImage.jpg" file, stored in the "public/images"
        # directory, where "public" is in the application's source directory.

        img = Image("images/myImage.jpg")
        img.addClickListener(getattr(self, "onImageClicked"))
        self.add(img)
Ejemplo n.º 21
0
 def prepareImage(self, url):
     img = Image()
     img.__isLoaded = False
     img.addLoadListener(self)
     # normally, event listeners are only set up when the widget
     # is attached to part of the DOM (see Widget.onAttach).  but,
     # in this case, we want a load even _even though_ the Image
     # widget is not yet attached (and quite likely won't be).
     DOM.setEventListener(img.getElement(), img)
     return img
Ejemplo n.º 22
0
 def add_formula(self, f):
     h = HorizontalPanel()
     im = Image()
     im.setUrl(latex_to_url(f.to_latex()))
     c = CheckBox()
     h.add(c)
     h.add(im)
     self.pok.add(h)
     self.checkbox_list.append(c)
     self.hpanel_list.append(h)
     self.image_list.append(im)
Ejemplo n.º 23
0
    def __init__(self, text, imageUrl):

        DecoratorPanel.__init__(self, DecoratorPanel.DECORATE_ALL)
        p = HorizontalPanel()
        p.setSpacing(3)
        self.img = Image(imageUrl)
        self.txt = HTML(text)
        p.add(self.img)
        p.add(self.txt)

        self.add(p)
Ejemplo n.º 24
0
class FormulaBuilder(DialogWindow):

    def __init__(self, operations,after,type='rel'):
        DialogWindow.__init__(self, modal=True, close=True)
        self.formula = Formula([])
        self.after=after

        left = 100
        top = 100

        self.ops_with_buttons = [{"op": op, "button": Button(op.name, self)} for op in operations if op.available]
        dock = DockPanel()
        dock.setSpacing(3)

        for owb in self.ops_with_buttons:
            dock.add(owb['button'], DockPanel.NORTH)

        dock.setWidth("300")

        self.image = Image(latex_to_url(self.formula.fill_with_placeholders().to_latex()))
        dock.add(self.image, DockPanel.EAST)
        dock.setCellHorizontalAlignment(self.image, HasAlignment.ALIGN_TOP)

        self.doneButton=Button("Done",self)
        self.doneButton.setEnabled(False)
        dock.add(self.doneButton,DockPanel.SOUTH)

        dock.add(HTML(""),DockPanel.CENTER)

        self.setText("opkop")
        self.setPopupPosition(left, top)
        self.setStyleAttribute("background-color", "#ffffff")
        self.setStyleAttribute("color", "blue")
        self.setStyleAttribute("border-width", "5px")
        self.setStyleAttribute("border-style", "solid")

        self.setWidget(dock)

    def onClick(self, sender):
        if sender==self.doneButton:
            self.hide()
            self.after(self.formula)

        op=None
        for owb in self.ops_with_buttons:
            if owb['button'] == sender:
                self.setText(sender.getText())
                op=owb['op']

        if not self.formula.is_closed():
            self.formula.add_one_op(op,type)
            self.image.setUrl(latex_to_url(self.formula.fill_with_placeholders().to_latex()))
            if self.formula.is_closed():
                self.doneButton.setEnabled(True)
Ejemplo n.º 25
0
	def RollButtonPressed(self):
		self.DiceInstance = random.randint(1, 6) # value turned after rolling the dice
		self.DPanel.remove(self.image, DockPanel.CENTER)
		self.image = Image("http://www.animatedimages.org/data/media/710/animated-dice-image-0064.gif")
		self.image.setSize("100px", "200px")
		self.DPanel.add(self.image, DockPanel.CENTER)
		self.DPanel.setCellHeight(self.image, "300px")
		self.DPanel.setCellWidth(self.image, "600px")
		RootPanel().add(self.DPanel)
		self.BankButton.setEnabled(False)
		self.RollButton.setEnabled(False)
		self.timer.schedule(3000)
Ejemplo n.º 26
0
    def __init__(self, format='%d-%m-%Y'):
        DateSelectedHandler.__init__(self)
        if self.img_base is None:
            self.img_base = pygwt.getImageBaseURL(True)
        if self.icon_img is None:
            self.icon_img = self.img_base + 'icon_calendar.gif'
        self.format = format
        self.tbox = TextBox()
        self.tbox.setVisibleLength(10)
        # assume valid sep is - / . or nothing
        if format.find('-') >= 0:
            self.sep = '-'
        elif format.find('/') >= 0:
            self.sep = '/'
        elif format.find('.') >= 0:
            self.sep = '.'
        else:
            self.sep = ''
        # self.sep = format[2] # is this too presumptious?
        self.calendar = Calendar()
        self.img = Image(self.icon_img)
        self.img.addStyleName(self.icon_style)
        self.calendarLink = HyperlinkImage(self.img)
        self.todayLink = Hyperlink(self.today_text)
        self.todayLink.addStyleName(self.today_style)
        #
        # lay it out
        #
        hp = HorizontalPanel()
        hp.setSpacing(2)
        vp = VerticalPanel()
        hp.add(self.tbox)
        vp.add(self.calendarLink)
        vp.add(self.todayLink)
        #vp.add(self.calendar)
        hp.add(vp)

        Composite.__init__(self)
        self.initWidget(hp)
        #
        # done with layout, so now set up some listeners
        #
        self.tbox.addFocusListener(self) # hook to onLostFocus
        self.calendar.addSelectedDateListener(getattr(self, "onDateSelected"))
        self.todayLink.addClickListener(getattr(self, "onTodayClicked"))
        self.calendarLink.addClickListener(getattr(self, "onShowCalendar"))

        self.tbox.addChangeListener(getattr(self, "onFieldChanged"))
        self.tbox.addInputListener(getattr(self, "onFieldChanged"))

        self._last_date = None
Ejemplo n.º 27
0
    def __init__(self, sink):
        SimplePanel.__init__(self)
        self.sink = sink
        self.caption = HTML()
        self.child = None
        self.showing = False
        self.dragging = False
        self.dragStartX = 0
        self.dragStartY = 0
        self.panel = FlexTable()

        self.collapse = Image("./images/cancel.png")
        self.collapse.addClickListener(self)
        dock = DockPanel()
        dock.setSpacing(0)

        dock.add(self.collapse, DockPanel.EAST)
        dock.add(self.caption, DockPanel.WEST)

        dock.setCellHorizontalAlignment(self.collapse,
                                        HasAlignment.ALIGN_RIGHT)
        dock.setCellVerticalAlignment(self.collapse, HasAlignment.ALIGN_TOP)
        dock.setCellHorizontalAlignment(self.caption, HasAlignment.ALIGN_LEFT)
        dock.setCellWidth(self.caption, "100%")
        dock.setWidth("100%")
        dock.setHeight("100%")

        self.panel.setWidget(0, 0, dock)
        self.panel.setHeight("100%")
        self.panel.setWidth("100%")
        self.panel.setBorderWidth(0)
        self.panel.setCellPadding(0)
        self.panel.setCellSpacing(0)
        self.panel.getCellFormatter().setHeight(1, 0, "100%")
        self.panel.getCellFormatter().setWidth(1, 0, "100%")
        self.panel.getCellFormatter().setAlignment(
            1, 0, HasHorizontalAlignment.ALIGN_LEFT,
            HasVerticalAlignment.ALIGN_TOP)
        SimplePanel.setWidget(self, self.panel)

        self.setStyleName("gwt-DialogBox")
        self.caption.setStyleName("Caption")
        self.collapse.setStyleName("Close")
        dock.setStyleName("Header")
        #self.caption.addMouseListener(self)
        self.collapsed = False

        self.collapsed_width = "15px"
        self.uncollapsed_width = "100%"
Ejemplo n.º 28
0
    def make_footer(self):
        self.time = {}

        self.time['hour'] = ListBox()
        self.time['hour'].setVisibleItemCount(1)
        for hour in range(24):
            self.time['hour'].addItem('%02d' % hour)
        self.time['hour'].setSelectedIndex(12)

        self.time['minute'] = ListBox()
        self.time['minute'].setVisibleItemCount(1)
        for minute in range(0, 60, 5):
            self.time['minute'].addItem('%02d' % minute)
        self.time['minute'].setSelectedIndex(0)

        time_panel = HorizontalPanel()
        time_panel.setVerticalAlignment('center')
        time_panel.add(self.time['hour'])
        time_panel.add(Label(':'))
        time_panel.add(self.time['minute'])
        self.table.setWidget(1, 0, time_panel)

        weekdays_panel = HorizontalPanel()
        weekdays_panel.setSpacing(5)
        self.weekdays = {}
        for i in range(7):
            self.weekdays[i] = CheckBox(AlarmWidget.weekday_name[i])
            self.weekdays[i].setChecked(i < 6)
            weekdays_panel.add(self.weekdays[i])
        self.table.setWidget(1, 1, weekdays_panel)

        self.duration = ListBox()
        self.duration.setVisibleItemCount(1)
        choices = [ 1, 2, 3, 4, 5, 7, 10, 15, 20, 25, 30, 40, 50, 60 ]
        for seconds in choices:
            self.duration.addItem(
                    '%ds' % seconds if seconds < 60 else '%dm' % (seconds / 60),
                    seconds)
        self.duration.setSelectedIndex(2)
        self.table.setWidget(1, 2, self.duration)

        image = Image('icons/plus.png')
        image.setTitle('add');
        image.addClickListener(self.plus_clicked)
        self.table.setWidget(1, 3, image)

        for col in range(4):
            self.table.getCellFormatter().setStyleName(1, col, 'tablecell noborder')
Ejemplo n.º 29
0
 def __init__(self, userListPanel, tabPanel, topPanel):
     VerticalPanel.__init__(self, StyleName='large-avatar-panel')
     self.userListPanel = userListPanel
     self.tabPanel = tabPanel
     self.topPanel = topPanel
     upperPanel = HorizontalPanel(StyleName='large-avatar-upper-panel',
                                  Spacing=8)
     self.image = Image(StyleName='large-avatar')
     self.upperText = HTML(StyleName='large-avatar-upper-text')
     upperPanel.add(self.image)
     upperPanel.add(self.upperText)
     self.add(upperPanel)
     self.lowerText = HTML(StyleName='large-avatar-lower-text')
     self.add(self.lowerText)
     self.followButton = None
     self.user = None
     insertPanel = HorizontalPanel(Spacing=3)
     insertPanel.add(Label('Use name: '))
     if tabPanel.tabName == 'simple':
         b1 = Button('upper', SimpleInserter(self, 'upper'))
         b2 = Button('lower', SimpleInserter(self, 'lower'))
         insertPanel.add(b1)
         insertPanel.add(b2)
     else:
         b1 = Button('or', QueryInserter(self, 'or'))
         b2 = Button('and', QueryInserter(self, 'and'))
         b3 = Button('except', QueryInserter(self, 'except'))
         insertPanel.add(b1)
         insertPanel.add(b2)
         insertPanel.add(b3)
     self.add(insertPanel)
Ejemplo n.º 30
0
    def __init__(self, baseURL):
        DialogWindow.__init__(
            self,
            modal=False,
            minimize=True,
            maximize=True,
            close=True,
        )
        closeButton = Button("Close", self)
        imgname = self.images.pop(0)
        self.images.append(imgname)
        self.setText("Sample DialogWindow with embedded image")
        img = Image("%srembrandt/%s" % (baseURL, imgname))
        msg = HTML(
            "<center>This is an example of a standard dialog box component.<br>  You can put pretty much anything you like into it,<br>such as the following image '%s':</center>"
            % imgname, True)

        dock = DockPanel()
        dock.setSpacing(4)

        dock.add(closeButton, DockPanel.SOUTH)
        dock.add(msg, DockPanel.NORTH)
        dock.add(img, DockPanel.CENTER)

        dock.setCellHorizontalAlignment(closeButton, HasAlignment.ALIGN_RIGHT)
        dock.setCellWidth(img, "100%")
        dock.setWidth("100%")
        self.setWidget(dock)
Ejemplo n.º 31
0
    def __init__(self, theorem, **kwargs):
        DialogWindow.__init__(self, modal=True, close=True)
        self.theorem=theorem
        v = VerticalPanel()
        v.setWidth(300)
        # v.setHeight(500)
        self.setText("save")
        self.setPopupPosition(100, 100)
        self.setStyleAttribute("background-color", "#ffffff")
        self.setStyleAttribute("color", "red")
        self.setStyleAttribute("border-width", "5px")
        self.setStyleAttribute("border-style", "solid")
        self.im=Image()
        self.im.setUrl(latex_to_url(self.theorem.formula.to_latex()))
        v.add(self.im)
        h=HorizontalPanel()
        self.radio=RadioButton("group1", "Existing folder:")
        h.add(self.radio)
        self.list = ListBox()
        self.list.setVisibleItemCount(1)
        for f in Theorem.get_all_folders():
            self.list.addItem(f)

        h.add(self.list)
        v.add(h)
        h=HorizontalPanel()
        h.add(RadioButton("group1", "New folder:"))
        self.radio.setChecked(True)
        self.textbox=TextBox()
        h.add(self.textbox)
        v.add(h)
        v.add(Button("Done",self.done_click))
        self.add(v)
Ejemplo n.º 32
0
class PrettyTab(Composite):
    def __init__(self, text, imageUrl):

        DecoratorPanel.__init__(self, DecoratorPanel.DECORATE_ALL)
        p = HorizontalPanel()
        p.setSpacing(3)
        self.img = Image(imageUrl)
        self.txt = HTML(text)
        p.add(self.img)
        p.add(self.txt)

        self.add(p)

    def addClickListener(self, listener):

        self.img.addClickListener(listener)
        self.txt.addClickListener(listener)
Ejemplo n.º 33
0
 def onRemoteResponse(self, result, request_info):
     if result['result']:
         self.sender.screenname = screenname = result['screen_name']
         h = HTML('%s&nbsp;' % utils.screennameToTwitterLink(screenname),
                  StyleName='logged-in-text')
         self.sender.setWidget(0, 0, h)
         logout = Image('logout.gif', StyleName='logout-image')
         logout.addMouseListener(self)
         self.sender.setWidget(0, 1, logout)
         remote = server.TickeryService()
         id = remote.friendsIds(self.sender.oauthCookie,
             screenname, SetFriends(screenname, self.sender))
         if id < 0:
             self.sender.setWidget(
                 0, 1, Label("Oops: Couldn't fetch friends."))
     else:
         self.sender.notLoggedIn()
Ejemplo n.º 34
0
class PrettyTab(Composite):

    def __init__(self, text, imageUrl):

        DecoratorPanel.__init__(self, DecoratorPanel.DECORATE_ALL)
        p = HorizontalPanel()
        p.setSpacing(3)
        self.img = Image(imageUrl)
        self.txt = HTML(text)
        p.add(self.img)
        p.add(self.txt)

        self.add(p)

    def addClickListener(self, listener):

        self.img.addClickListener(listener)
        self.txt.addClickListener(listener)
Ejemplo n.º 35
0
 def actCircuitTikzSubmit(self, **kwargs):
     id = kwargs.get('id')
     app = 'Circuit'
     sessionId = getCookie('session_id')
     image = 'api/image?app=Diagram&tab=Circuit&Id=%d&Cache=%d'%(id, self._cacheBreaker)
     self.layout.remove(self.display)
     self.display = Image(image)
     self.layout.insert(self.display, 1)
     self._cacheBreaker = self._cacheBreaker + 1
Ejemplo n.º 36
0
 def notLoggedIn(self):
     if self.oauthCookie:
         _deleteCookie()
         self.oauthCookie = None
     self.clear()
     self.loggedIn = False
     self.screenname = None
     self.friendsIds = None
     loginImage = Image('login.png', StyleName='login-image')
     loginImage.addMouseListener(self)
     self.setWidget(0, 0, loginImage)
     why = Button(WHY_BUTTON_TEXT, self, StyleName='why-button')
     self.setWidget(0, 1, why)
     self.instructions = HTML(WHY_TEXT,
                              StyleName='instructions-popup',
                              HorizontalAlignment=HasAlignment.ALIGN_LEFT)
     self.popup = tickerytab.InstructionBox(
         self.__class__.__name__, self.instructions)
     self.popup.setText(WHY_TITLE)
Ejemplo n.º 37
0
    def add(self, time, weekdays=range(5), duration=3):
        row = self.table.getRowCount()-1
        self.table.insertRow(row)
        self.table.setText(row, 0, time)
        weekdays_str = []
        for weekday in weekdays:
            weekdays_str.append(AlarmWidget.weekday_name[weekday])

        self.table.setText(row, 1, ', '.join(weekdays_str))
        self.table.setText(row, 2, str(duration) + 's')

        image = Image('icons/x.png')
        image.setTitle('delete');
        image.addClickListener(lambda x: self.x_clicked(row-1))
        self.table.setWidget(row, 3, image)

        for col in range(3):
            self.table.getCellFormatter().setStyleName(row, col, 'tablecell')
        self.table.getCellFormatter().setStyleName(row, 3, 'tablecell noborder')
Ejemplo n.º 38
0
    def __init__(self, text, imageUrl):

        DecoratorPanel.__init__(self, DecoratorPanel.DECORATE_ALL)
        p = HorizontalPanel()
        p.setSpacing(3)
        self.img = Image(imageUrl)
        self.txt = HTML(text)
        p.add(self.img)
        p.add(self.txt)

        self.add(p)
Ejemplo n.º 39
0
    def __init__(self, identifier, autoHide=None, modal=False, rootpanel=None):
        PopupPanel.__init__(self, autoHide, modal, rootpanel)

        self.identifier = identifier
        self.caption = HTML()
        self.child = None
        self.showing = False
        self.dragging = False
        self.dragStartX = 0
        self.dragStartY = 0
        self.panel = FlexTable()

        self.closeButton = Image("images/cancel.png")
        self.closeButton.addClickListener(self)
        dock = DockPanel()
        dock.setSpacing(0)

        dock.add(self.closeButton, DockPanel.EAST)
        dock.add(self.caption, DockPanel.WEST)

        dock.setCellHorizontalAlignment(self.closeButton,
                                        HasAlignment.ALIGN_RIGHT)
        dock.setCellHorizontalAlignment(self.caption, HasAlignment.ALIGN_LEFT)
        dock.setCellWidth(self.caption, "100%")
        dock.setWidth("100%")

        self.panel.setWidget(0, 0, dock)
        self.panel.setHeight("100%")
        self.panel.setBorderWidth(0)
        self.panel.setCellPadding(0)
        self.panel.setCellSpacing(0)
        self.panel.getCellFormatter().setHeight(1, 0, "100%")
        self.panel.getCellFormatter().setWidth(1, 0, "100%")
        #self.panel.getCellFormatter().setAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE)
        PopupPanel.setWidget(self, self.panel)

        self.setStyleName("gwt-DialogBox")
        self.caption.setStyleName("Caption")
        self.closeButton.setStyleName("Close")
        dock.setStyleName("Header")
        self.caption.addMouseListener(self)
Ejemplo n.º 40
0
 def __init__(self, handle, idx, image, variables = None, code = None, 
              perspective = '', checkOptions = [False, True]):
     VerticalPanel.__init__(self)
     self._handle = handle
     self.idx = idx
     # set style
     self.setStyleName('os-mech-drawing')  
     # create widgets
     self._img = Image(image)
     self._img.setStyleName('os-mech-thumb')
     self._img.addClickListener(self.onClickDrawing)
     self._perspective = '%d - %s'%(idx, perspective.capitalize())
     self._optionPanel = MechOptionPanel(handle, idx, checkOptions)
     textArea  = TextArea(code)
     textArea.setText(code)
     textArea.setStyleName('os-mech-code-locked')
     textArea.setReadonly(self, True)
     # populate drawing
     self.add(self._img)
     self.add(self._optionPanel)
     self.add(textArea)
Ejemplo n.º 41
0
 def addToggleButton(self, panel, imagep, tip):
     img = Image(imagep)
     img.setWidth("20px")
     img.setHeight("20px")
     tb = ToggleButton(img)
     self.addAnyButton(panel, tb, tip)
     return tb
Ejemplo n.º 42
0
    def __init__(self):
        Algorithm.__init__(self)
        self.MLAlgorithmService = MLAlgorithmService(self)
        self.image = Image(self.baseURL() +
                           "services/kMeansPictures/lenna.png",
                           Width="320px",
                           Height="360px")
        self.resultImage = Image("", Width="320px", Height="360px")
        self.loadingImage = Image(self.baseURL() + "images/blanksearching.gif")
        self.calculateButton = Button("RUN", self.onButtonClick)
        self.log = Button("SHOW LOG", self.openLogFile)
        self.log.setEnabled(False)

        self.image.addLoadListener(self)

        topPanel = DockPanel()
        topPanel.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)
        topPanel.add(self.calculateButton, DockPanel.WEST)
        topPanel.add(self.loadingImage, DockPanel.CENTER)
        topPanel.add(self.log, DockPanel.EAST)

        panel = DockPanel()
        panel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER)
        panel.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)
        #panel.add(HTML("<h2>Image compression</h2>", True))
        panel.add(topPanel, DockPanel.NORTH)
        panel.add(self.image, DockPanel.WEST)
        panel.add(self.resultImage, DockPanel.EAST)

        panel.setWidth("100%")
        self.initWidget(panel)
        self.image.setStyleName("ks-images-Image")
        self.calculateButton.setStyleName("ks-images-Button")

        self.loadImage("picturem.png")
Ejemplo n.º 43
0
    def __init__(self):
        Sink.__init__(self)
        img = Image("images/num1.png")
        img.addMouseListener(TooltipListener("An image: " + img.getUrl()))

        img2 = Image("images/num2.png")
        img2.addMouseListener(TooltipListener("An image: " + img2.getUrl()))

        html = HTML("Some <i>HTML</i> text.")
        html.addMouseListener(TooltipListener("An HTML component."))

        panel_h = HorizontalPanel()
        panel_h.add(img)
        panel_h.add(img2)
        panel_h.setSpacing(8)

        panel = VerticalPanel()
        panel.add(panel_h)
        panel.add(html)

        panel.setSpacing(8)
        self.setWidget(panel)
Ejemplo n.º 44
0
 def setControls(self, minimize, maximize, close):
     if minimize is True:
         self.minimizeWidget = self.createDefaultControl('minimize')
     elif isinstance(minimize, basestring):
         self.minimizeWidget = Image(minimize)
     else:
         self.minimizeWidget = minimize
     if maximize is True:
         self.maximizeWidget = self.createDefaultControl('maximize')
     elif isinstance(maximize, basestring):
         self.maximizeWidget = Image(maximize)
     else:
         self.maximizeWidget = maximize
     if close is True:
         self.closeWidget = self.createDefaultControl('close')
     elif isinstance(close, basestring):
         self.closeWidget = Image(close)
     else:
         self.closeWidget = close
     if (isinstance(self.minimizeWidget, UIObject) or
         isinstance(self.maximizeWidget, UIObject) or
         isinstance(self.closeWidget, UIObject)):
         cf = self.panel.getCellFormatter()
         captionStyle = self.caption.getStyleName()
         captionPanel = FlexTable(
             Width="99%",
             BorderWidth="0",
             CellPadding="0",
             CellSpacing="0",
         )
         controls = HorizontalPanel()
         controls.setStyleName("Controls")
         controls.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE)
         if isinstance(self.minimizeWidget, UIObject):
             self.minimizeWidget.setStyleName("Minimize")
             controls.add(self.minimizeWidget)
             self.minimizeWidget.addClickListener(
                 getattr(self, "onMinimize"),
             )
         if isinstance(self.maximizeWidget, UIObject):
             self.maximizeWidget.setStyleName("Maximize")
             controls.add(self.maximizeWidget)
             self.maximizeWidget.addClickListener(
                 getattr(self, "onMaximize"),
             )
         if isinstance(self.closeWidget, UIObject):
             self.closeWidget.setStyleName("Close")
             controls.add(self.closeWidget)
             self.closeWidget.addClickListener(
                 getattr(self, "onClose"),
             )
             self.closeable = True
         self.caption.removeStyleName(captionStyle)
         self.panel.setWidget(0, 0, captionPanel)
         captionPanel.setWidget(0, 0, self.caption)
         captionPanel.setWidget(0, 1, controls)
         captionPanel.setStyleName(captionStyle)
         cf = captionPanel.getCellFormatter()
         cf.setWidth(0, 1, '1%')
Ejemplo n.º 45
0
 def prepareImage(self, url):
     img = Image()
     img.__isLoaded = False
     img.addLoadListener(self)
     # normally, event listeners are only set up when the widget
     # is attached to part of the DOM (see Widget.onAttach).  but,
     # in this case, we want a load even _even though_ the Image
     # widget is not yet attached (and quite likely won't be).
     DOM.setEventListener(img.getElement(), img)
     DOM.sinkEvents(img.getElement(), Event.ONLOAD)
     return img
Ejemplo n.º 46
0
    def addPushButton(self, panel, imagep, tip):
        img = Image(imagep)
        img.setWidth("20px")
        img.setHeight("20px")

        pb = PushButton(img)
        self.addAnyButton(panel, pb, tip)
        return pb
Ejemplo n.º 47
0
	def __init__(self):
		self.DPanel = DockPanel(HorizontalAlignment = HasAlignment.ALIGN_CENTER,
						Spacing=10) # Creates the Docker Panel Instance
		self.VPanel = VerticalPanel() # Creates the Vertical Panel Instance
		self.VPanel1 = VerticalPanel() # Creates the Vertical Panel Instance
		self.HPanel = HorizontalPanel() # Creates a Horizontal Panel Instance
		self.HPanel1 = HorizontalPanel()# Creates a Horizontal Panel Instance


		self.image=Image()#Creates the Image instance to embed the images of dice
		self.DummyUrl = self.image.getUrl() 
		self.timer = Timer(notify=self.StillImage)#Timer for display of gif animation
		self.timerRButton =  Timer(notify=self.OneAlert)#Timer for controlling states of Roll button 
													#whenever the output of the dice is 1

		self.RollButton = Button("Roll", getattr(self, "RollButtonPressed")) #Initially Disabled 
		self.RollButton.setEnabled(False)
		self.BankButton = Button("Bank", getattr(self, "BankButtonPressed")) #Initially Disabled 
		self.BankButton.setEnabled(False)
		#The start button controls both the number players as well the winning score
		self.StartButton = Button("Start", getattr(self, "StartButtonPressed")) #Intially Enabled
		self.StartButton.setEnabled(True)


		self.PlayerNum = TextBox() #Enter the Number of Players
		self.WinScore = TextBox() #Enter the Target Score
		self.PlayerNum.setText("0")
		self.WinScore.setText("0")
		# self.OK = Button("OK", getattr(self, "okButtonPressed"))

		self.NameScore = FlexTable() #main score board
		self.NameScore.setStyleName("NameScore")
		self.TempBoard = FlexTable() #Temporary score board
		self.TempBoard.setStyleName("TempBoard")

		

		self.TxtInstructions = HTML()
Ejemplo n.º 48
0
    def __init__(self, **kwargs):
        GMWevents.events.addPatientSelectedListener(self)
        HorizontalPanel.__init__(self, **kwargs)

        self.patientphoto = Image("images/empty-face-in-bust.png")
        self.searchbox = TextBox(Text="<search patient here>")
        self.search_button = Button("Search", self)
        self.lblcave = Label()
        self.lblcave.setText("cave")
        self.allergybox = TextBox(Text="allergies")
        self.add(self.patientphoto)
        self.add(self.searchbox)
        self.add(self.search_button)
        self.add(self.lblcave)
        self.add(self.allergybox)
Ejemplo n.º 49
0
 def draw(self):
     paramPanel = HorizontalPanel(Width='100%', VerticalAlignment='middle')
     options = self.drawOptions()
     label = Label(self.kind['item'], StyleName='aur-search-advanced-param-title')
     delSelf = Image(url='/ico/cross.png', Title='Delete this parameter')
     delSelf.addStyleName('aur-search-advanced-delete')
     if self.kind['allowsInverse']:
         invertSelf = Image(url='/ico/exclamation.png', Title='Invert this parameter')
         invertSelf.addClickListener(getattr(self, 'invertSelf'))
     else:
         invertSelf = Image(url='/ico/bullet_white.png', StyleName='aur-search-advanced-placeholder')
     self.container.add(self.panel)
     self.panel.setWidget(paramPanel)
     paramPanel.add(delSelf)
     paramPanel.add(label)
     paramPanel.add(options)
     paramPanel.add(invertSelf)
     paramPanel.setCellWidth(delSelf, '1px')
     paramPanel.setCellWidth(options, '1px')
     paramPanel.setCellWidth(invertSelf, '1px')
     delSelf.addClickListener(getattr(self, 'delSelf'))
Ejemplo n.º 50
0
    def __init__(self, sink):
        SimplePanel.__init__(self)
        self.sink = sink
        self.caption = HTML()
        self.child = None 
        self.showing = False
        self.dragging = False
        self.dragStartX = 0
        self.dragStartY = 0
        self.panel = FlexTable()

        self.collapse = Image("./images/cancel.png")
        self.collapse.addClickListener(self)
        dock = DockPanel()
        dock.setSpacing(0)
        
        dock.add(self.collapse, DockPanel.EAST)
        dock.add(self.caption, DockPanel.WEST)

        dock.setCellHorizontalAlignment(self.collapse, HasAlignment.ALIGN_RIGHT)
        dock.setCellVerticalAlignment(self.collapse, HasAlignment.ALIGN_TOP)
        dock.setCellHorizontalAlignment(self.caption, HasAlignment.ALIGN_LEFT)
        dock.setCellWidth(self.caption, "100%")
        dock.setWidth("100%")
        dock.setHeight("100%")

        self.panel.setWidget(0, 0, dock)
        self.panel.setHeight("100%")
        self.panel.setWidth("100%")
        self.panel.setBorderWidth(0)
        self.panel.setCellPadding(0)
        self.panel.setCellSpacing(0)
        self.panel.getCellFormatter().setHeight(1, 0, "100%")
        self.panel.getCellFormatter().setWidth(1, 0, "100%")
        self.panel.getCellFormatter().setAlignment(1, 0, HasHorizontalAlignment.ALIGN_LEFT, HasVerticalAlignment.ALIGN_TOP)
        SimplePanel.setWidget(self, self.panel)

        self.setStyleName("gwt-DialogBox")
        self.caption.setStyleName("Caption")
        self.collapse.setStyleName("Close")
        dock.setStyleName("Header")
        #self.caption.addMouseListener(self)
        self.collapsed = False

        self.collapsed_width = "15px"
        self.uncollapsed_width = "100%"
Ejemplo n.º 51
0
 def __init__(self, up_url, down_url, up_msg, down_msg):
     Composite.__init__(self)
     self.state = "up"
     self.up_url = up_url
     self.down_url = down_url
     self.up_msg = up_msg
     self.down_msg = down_msg
     self.control = VerticalPanel()
     self.image = Image(up_url)
     self.image.setStyleName("gwt-Image-Cell")
     self.text = HTML(up_msg)
     self.image.base = self
     self.text.base = self
     self.text.horzAlign = "center"
     self.control.add(self.image)
     self.control.add(self.text)
     self.initWidget(self.control)
Ejemplo n.º 52
0
    def __init__(self, identifier, autoHide=None, modal=False, rootpanel=None):
        PopupPanel.__init__(self, autoHide, modal, rootpanel)

        self.identifier = identifier
        self.caption = HTML()
        self.child = None
        self.showing = False
        self.dragging = False
        self.dragStartX = 0
        self.dragStartY = 0
        self.panel = FlexTable()

        self.closeButton = Image('cancel.png')
        self.closeButton.addClickListener(self)
        dock = DockPanel()
        dock.setSpacing(0)

        dock.add(self.closeButton, DockPanel.EAST)
        dock.add(self.caption, DockPanel.WEST)

        dock.setCellHorizontalAlignment(self.closeButton,
                                        HasAlignment.ALIGN_RIGHT)
        dock.setCellHorizontalAlignment(self.caption, HasAlignment.ALIGN_LEFT)
        dock.setCellWidth(self.caption, '100%')
        dock.setWidth('100%')

        self.panel.setWidget(0, 0, dock)
        self.panel.setHeight('100%')
        self.panel.setBorderWidth(0)
        self.panel.setCellPadding(0)
        self.panel.setCellSpacing(0)
        self.panel.getCellFormatter().setHeight(1, 0, '100%')
        self.panel.getCellFormatter().setWidth(1, 0, '100%')
        #self.panel.getCellFormatter().setAlignment(1, 0,
        # HasHorizontalAlignment.ALIGN_CENTER,
        # HasVerticalAlignment.ALIGN_MIDDLE)
        PopupPanel.setWidget(self, self.panel)

        self.setStyleName('gwt-DialogBox')
        self.caption.setStyleName('Caption')
        self.closeButton.setStyleName('Close')
        dock.setStyleName('Header')
        self.caption.addMouseListener(self)
Ejemplo n.º 53
0
    def __init__(self):
        Sink.__init__(self)
        img = Image("images/num1.png")
        img.addMouseListener(TooltipListener("An image: " + img.getUrl()))
        
        img2 = Image("images/num2.png")
        img2.addMouseListener(TooltipListener("An image: " + img2.getUrl()))

        html = HTML("Some <i>HTML</i> text.")
        html.addMouseListener(TooltipListener("An HTML component."))
        
        panel_h = HorizontalPanel()
        panel_h.add(img)
        panel_h.add(img2)       
        panel_h.setSpacing(8)
        
        panel = VerticalPanel()
        panel.add(panel_h)
        panel.add(html)
        
        panel.setSpacing(8)
        self.setWidget(panel)
	def __init__( self ) :
		self.cbcList=ListBox(MultipleSelect=True, VisibleItemCount=4)
		self.channelList=ListBox(MultipleSelect=True, VisibleItemCount=20)
		self.updateButton=Button("Update")

		controls=VerticalPanel()
		controls.add(self.updateButton)
		controls.add(self.cbcList)
		controls.add(self.channelList)

		controls.setCellHorizontalAlignment( self.updateButton, HasHorizontalAlignment.ALIGN_CENTER )
		self.cbcList.setWidth("95%")
		self.channelList.setWidth("95%")

		self.cbcList.addItem( "waiting..." )
		for index in range(0,254) :
			self.channelList.addItem( "Channel %3d"%index )

		self.histogram = Image()
		self.mainPanel = HorizontalPanel()
		self.mainPanel.add( controls )
		self.mainPanel.add( self.histogram )
		self.histogram.setUrl( "defaultScurveHistogram.png" )