Mailinglist Archive: yast-devel (73 mails)

< Previous Next >
[yast-devel] [patch] widget.py v0.1 -> v0.2 diff
  • From: "Jan-Simon Möller" <dl9pf@xxxxxx>
  • Date: Thu, 7 Aug 2008 16:15:48 +0200
  • Message-id: <200808071615.48494.dl9pf@xxxxxx>
Updated and more widgets ...

have phun!

Jan-Simon Möller

Index: widgets.py
===================================================================
--- widgets.py (Revision 49824)
+++ widgets.py (Arbeitskopie)
@@ -44,9 +44,11 @@
# | x | code |
# +---+-----------+
self.mainhbox = self.factory.createHBox(self.dialog)
- self.selbox = self.factory.createSelectionBox(self.mainhbox, "Widgets")
- self.selbox.setWeight(0,20)
+ self.mainvbox = self.factory.createVBox(self.mainhbox)
+ self.mainvbox.setWeight(0,20)
+ self.selbox = self.factory.createSelectionBox(self.mainvbox, "Widgets")
self.selbox.setNotify()
+ self.closebutton = self.factory.createPushButton(self.mainvbox,
"&Close")
self.boxright = self.factory.createVBox(self.mainhbox)
self.boxright.setWeight(0,80)
self.framedisplay = self.factory.createFrame(self.boxright, "View")
@@ -117,6 +119,9 @@
if event.eventType() == yui.YEvent.CancelEvent:
self.dialog.destroy()
break
+ if event.widget() == self.closebutton:
+ self.dialog.destroy()
+ break
if event.widget() == self.selbox:
self.updatedisplay()
self.updatedescription()
@@ -138,7 +143,7 @@
myComboBox.addItem("Item") <br>

Event: <br>
- if event.widget == myComboBox: <br>
+ if event.widget() == myComboBox: <br>
dosomething() """]
avwidgets["InputField"]=['createInputField(self.display, "Inputfield")',
'.setValue("Input nonsense here")',
@@ -149,8 +154,64 @@
myInputField.setValue("Insert valid input here")
<br>

myInputField.setValidChars("abcdefghijklmnopqrstuvwxyz") <br>
Event: <br>
- if event.widget = myInputField: <br>
+ if event.widget() = myInputField: <br>
value = myInputField.value()
"""]
+ avwidgets["CheckBox"] =['createCheckBox(self.display, "Checkbox")',
+ '.setChecked(True)',
+ None,
+ """This Widget is a Checkbox""",
+ """Code:<br>
+ myCheckBox = fatory.createCheckbox(parentWidget,
"Name") <br>
+ myCheckbox.setEnabled(True) <br>
+ Event: <br>
+ if event.widget() == myCheckbox: <br>
+ if myCheckbox.isChecked(): <br>
+ print "Box is checked"
+ """]
+ avwidgets["Frame"] =['createFrame(self.display, "Frame")',
+ '.setStretchable(0,True)',
+ None,
+ """This Widget is a Frame. It can hold other
widgets (vbox,hbox,single widget).""",
+ """Code:<br>
+ myFrame = factory.createFrame(parentWidget,
"Name") <br>
+ """]
+ avwidgets["Label"] =['createLabel(self.display, "Label")',
+ None,
+ None,
+ """This Widget is a Label""",
+ """Code: <br>
+ myLabel = factory.createLabel(parentWidget,
"LabelText") <br>
+ """]
+ avwidgets["LogView"] =['createLogView(self.display, "LogView", 10, 10)',
+ '.appendLines("Logtext1 ")',
+ '.appendLines("Logtext2 ")',
+ """This Widget is a Log-window.""",
+ """Code:<br>
+ myLogView = factory.createLogView(parentWidget,
"Name", nrLinesShown, nrLinesCached)<br>
+ myLogView.appendLines("Logtext1")
+ """] # can't use \n in Logtext1 ... need to check
+ avwidgets["ProgressBar"]=['createProgressBar(self.display, "ProgressBar",
100)',
+ '.setValue(10)',
+ None,
+ """This Widget is a ProgressBar.""",
+ """Code:<br>
+ myProgressBar =
factory.createProgressBar(parentWidget, "Name", maxpercentvalue) <br>
+ e.g.: <br>
+ myProgressBar =
factory.createProgressBar(dialog, "Progress", 100") <br>
+ myProgressBar.setValue(33)
+ """]
+ avwidgets["SelectionBox"]=['createSelectionBox(self.display, "Selection")',
+ '.addItem("SELBOX_item1")',
+ '.addItem("SELBOX_item2")',
+ """This Widget is a SelectionBox""",
+ """Code:<br>
+ mySelectionBox =
factory.createSelectionBox(parentWidget, "Name") <br>
+ mySelectionBox.addItem("Item1") <br>
+ Event:<br>
+ if event.widget() = mySelectionBox: <br>
+ selected = mySelectionBox.selectedItem()
+ """]
MY_MAIN_GUI = WIDGETS(avwidgets)
- MY_MAIN_GUI.handleevent()
\ No newline at end of file
+ MY_MAIN_GUI.handleevent()
+
< Previous Next >
Follow Ups