diff options
Diffstat (limited to 'korundum/rubylib/examples/uimodules/uidialogs.rb')
-rw-r--r-- | korundum/rubylib/examples/uimodules/uidialogs.rb | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/korundum/rubylib/examples/uimodules/uidialogs.rb b/korundum/rubylib/examples/uimodules/uidialogs.rb index 524cc73a..72f1ca80 100644 --- a/korundum/rubylib/examples/uimodules/uidialogs.rb +++ b/korundum/rubylib/examples/uimodules/uidialogs.rb @@ -2,7 +2,7 @@ This is a ruby version of Jim Bublitz's pytde program, translated by Richard Dale =end -require 'Korundum' +retquire 'Korundum' module UIDialogs @@ -16,15 +16,15 @@ class CustomDlg < KDE::Dialog x = 20 y = 10 - rLbl = Qt::Label.new("r", self) - gLbl = Qt::Label.new("g", self) - bLbl = Qt::Label.new("b", self) - @rEd = Qt::LineEdit.new("64", self) - @gEd = Qt::LineEdit.new("64", self) - @bEd = Qt::LineEdit.new("64", self) - dlgBtn = Qt::PushButton.new("Set/Get Color", self) - okBtn = Qt::PushButton.new("OK", self) - canBtn = Qt::PushButton.new("Cancel", self) + rLbl = TQt::Label.new("r", self) + gLbl = TQt::Label.new("g", self) + bLbl = TQt::Label.new("b", self) + @rEd = TQt::LineEdit.new("64", self) + @gEd = TQt::LineEdit.new("64", self) + @bEd = TQt::LineEdit.new("64", self) + dlgBtn = TQt::PushButton.new("Set/Get Color", self) + okBtn = TQt::PushButton.new("OK", self) + canBtn = TQt::PushButton.new("Cancel", self) rLbl.setGeometry(x, y, 25, 20) gLbl.setGeometry(x + 30, y, 25, 20) @@ -50,8 +50,8 @@ class CustomDlg < KDE::Dialog green = @gEd.text().to_i blue = @bEd.text().to_I - # convert the numbers to a Qt::Color - color = Qt::Color.new(red, green, blue) + # convert the numbers to a TQt::Color + color = TQt::Color.new(red, green, blue) # invoke the dialog(getColor is a 'static' call) # initialize with the colors from above(in color) @@ -62,7 +62,7 @@ class CustomDlg < KDE::Dialog # get the numerical color values back # red, green, blue = color.rgb() - # update the Qt::LineEdits in the original dialog + # update the TQt::LineEdits in the original dialog @rEd.setText(red.to_s) @gEd.setText(green.to_s) @bEd.setText(blue.to_s) @@ -89,15 +89,15 @@ class MessageDlg < KDE::Dialog n = buttons.length - grp = Qt::ButtonGroup.new(n, Qt::Vertical, "MessageBoxes", self, "button grp") + grp = TQt::ButtonGroup.new(n, TQt::Vertical, "MessageBoxes", self, "button grp") grp.setGeometry(10, 10, 200, 30*n) - (0...n).each { |i| Qt::RadioButton.new(buttons[i], grp) } + (0...n).each { |i| TQt::RadioButton.new(buttons[i], grp) } connect(grp, SIGNAL("clicked(int)"), SLOT('launch(int)')) end def launch(which) - which += 1 # Qt::ButtonGroup id's start at 0, but the KDE::MessageBox enum starts at 1 + which += 1 # TQt::ButtonGroup id's start at 0, but the KDE::MessageBox enum starts at 1 if which == KDE::MessageBox::QuestionYesNo KDE::MessageBox.questionYesNo(self, "This is a questionYesNo message box\nThere is also a list version of this dialog",\ @@ -133,7 +133,7 @@ end def UIDialogs.dlgKAboutDialog(parent) dlg = KDE::AboutDialog.new(parent, 'about dialog', false) - dlg.setLogo(Qt::Pixmap.new("rbtestimage.png")) + dlg.setLogo(TQt::Pixmap.new("rbtestimage.png")) dlg.setTitle("UISampler for Korundum") dlg.setAuthor("Jim Bublitz", "jbublitz@nwinternet.com", "http://www.riverbankcomputing.co.uk", "\n\nPyKDE -- Python bindings\n\tfor KDE") @@ -175,17 +175,17 @@ def UIDialogs.dlgKDialogBase(parent) # making 'page' the parent inserts the widgets in # the VBox created above - label = Qt::Label.new( caption, page, "caption" ); + label = TQt::Label.new( caption, page, "caption" ); - lineedit = Qt::LineEdit.new(text_, page, "lineedit" ); + lineedit = TQt::LineEdit.new(text_, page, "lineedit" ); lineedit.setMinimumWidth(dlg.fontMetrics().maxWidth()*20); - label0 = Qt::Label.new("Border widths", page) + label0 = TQt::Label.new("Border widths", page) # widths = dlg.getBorderWidths() -# labelA = Qt::Label.new("Upper Left X: " + widths[0].to_s, page) -# labelB = Qt::Label.new("Upper Left Y: " + widths[0].to_s, page) -# labelC = Qt::Label.new("Lower Right X: " + str(c), page) -# labelD = Qt::Label.new("Lower Right Y: " + str(d), page) +# labelA = TQt::Label.new("Upper Left X: " + widths[0].to_s, page) +# labelB = TQt::Label.new("Upper Left Y: " + widths[0].to_s, page) +# labelC = TQt::Label.new("Lower Right X: " + str(c), page) +# labelD = TQt::Label.new("Lower Right Y: " + str(d), page) dlg.show() end @@ -204,7 +204,7 @@ def UIDialogs.dlgKKeyDialog(parent) end def UIDialogs.dlgKInputDialog(parent) - ok = Qt::Boolean.new + ok = TQt::Boolean.new result = KDE::InputDialog.getText("Enter text", "", "<Your input here>", ok) # puts "result: %s" % result # puts "ok: %s" % ok @@ -231,14 +231,14 @@ end def UIDialogs.dlgKWizard(parent) wiz = KDE::Wizard.new(parent) - page1 = Qt::Widget.new(wiz) - p1Lbl = Qt::Label.new("This is page 1", page1) + page1 = TQt::Widget.new(wiz) + p1Lbl = TQt::Label.new("This is page 1", page1) p1Lbl.setGeometry(20, 20, 100, 20) - page2 = Qt::Widget.new(wiz) - p2Lbl = Qt::Label.new("This is page 2", page2) + page2 = TQt::Widget.new(wiz) + p2Lbl = TQt::Label.new("This is page 2", page2) p2Lbl.setGeometry(50, 20, 100, 20) - page3 = Qt::Widget.new(wiz) - p3Lbl = Qt::Label.new("This is page 3", page3) + page3 = TQt::Widget.new(wiz) + p3Lbl = TQt::Label.new("This is page 3", page3) p3Lbl.setGeometry(80, 20, 100, 20) wiz.addPage(page1, "Page 1") |