manqod 1.1505.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/manqod +309 -0
- data/doc/HOWTOS +11 -0
- data/doc/INSTALL +6 -0
- data/doc/LICENCE +450 -0
- data/doc/README +33 -0
- data/doc/benchmarkings/ListLoader.rb +177 -0
- data/doc/manqod.png +0 -0
- data/doc/manqod.svg +99 -0
- data/doc/server.conf.example +24 -0
- data/lib/About.rb +93 -0
- data/lib/BarMenu/BarMenuItem.rb +46 -0
- data/lib/BarMenu.rb +76 -0
- data/lib/ButtonMenu/ButtonMenuItem.rb +82 -0
- data/lib/ButtonMenu/EndSeparator.rb +14 -0
- data/lib/ButtonMenu/StartSeparator.rb +14 -0
- data/lib/ButtonMenu.rb +154 -0
- data/lib/Common/Conf.rb +119 -0
- data/lib/Common/Eprint.rb +180 -0
- data/lib/Common/EventCache.rb +41 -0
- data/lib/Common/Fixnum.rb +18 -0
- data/lib/Common/Images.rb +41 -0
- data/lib/Common/ManqodDB.rb +40 -0
- data/lib/Common/MyExec.rb +77 -0
- data/lib/Common/MyImage.rb +47 -0
- data/lib/Common/Nick.rb +25 -0
- data/lib/Common/String.rb +15 -0
- data/lib/FormHolder/Form/InputHolder/Button.rb +133 -0
- data/lib/FormHolder/Form/InputHolder/Calendar.rb +101 -0
- data/lib/FormHolder/Form/InputHolder/CalendarButton.rb +117 -0
- data/lib/FormHolder/Form/InputHolder/ColorButton.rb +54 -0
- data/lib/FormHolder/Form/InputHolder/Combo.rb +82 -0
- data/lib/FormHolder/Form/InputHolder/ComboWithNew.rb +103 -0
- data/lib/FormHolder/Form/InputHolder/Common/Model.rb +337 -0
- data/lib/FormHolder/Form/InputHolder/ConstCombo.rb +18 -0
- data/lib/FormHolder/Form/InputHolder/ConstText.rb +17 -0
- data/lib/FormHolder/Form/InputHolder/Duration.rb +73 -0
- data/lib/FormHolder/Form/InputHolder/EditableList.rb +57 -0
- data/lib/FormHolder/Form/InputHolder/FieldCombo.rb +40 -0
- data/lib/FormHolder/Form/InputHolder/FieldList.rb +40 -0
- data/lib/FormHolder/Form/InputHolder/FileChooser.rb +131 -0
- data/lib/FormHolder/Form/InputHolder/FontButton.rb +37 -0
- data/lib/FormHolder/Form/InputHolder/FormImage.rb +74 -0
- data/lib/FormHolder/Form/InputHolder/HScale.rb +44 -0
- data/lib/FormHolder/Form/InputHolder/Hidden.rb +41 -0
- data/lib/FormHolder/Form/InputHolder/Label.rb +40 -0
- data/lib/FormHolder/Form/InputHolder/List.rb +176 -0
- data/lib/FormHolder/Form/InputHolder/MultiLine.rb +63 -0
- data/lib/FormHolder/Form/InputHolder/Password.rb +41 -0
- data/lib/FormHolder/Form/InputHolder/QBuilder/QObject.rb +269 -0
- data/lib/FormHolder/Form/InputHolder/QBuilder.rb +333 -0
- data/lib/FormHolder/Form/InputHolder/RadioGroup.rb +82 -0
- data/lib/FormHolder/Form/InputHolder/SourceView.rb +100 -0
- data/lib/FormHolder/Form/InputHolder/Spin.rb +49 -0
- data/lib/FormHolder/Form/InputHolder/Text.rb +55 -0
- data/lib/FormHolder/Form/InputHolder/TimeStamp.rb +82 -0
- data/lib/FormHolder/Form/InputHolder/TimeStampButton.rb +93 -0
- data/lib/FormHolder/Form/InputHolder/Toggle.rb +43 -0
- data/lib/FormHolder/Form/InputHolder.rb +458 -0
- data/lib/FormHolder/Form.rb +529 -0
- data/lib/FormHolder.rb +203 -0
- data/lib/Gtk.rb +101 -0
- data/lib/GtkAttributes.rb +76 -0
- data/lib/Kernel.rb +48 -0
- data/lib/ListHolder/EditableList/CellRenderers/Combo.rb +91 -0
- data/lib/ListHolder/EditableList/CellRenderers/ComboText.rb +22 -0
- data/lib/ListHolder/EditableList/CellRenderers/ConstCombo.rb +12 -0
- data/lib/ListHolder/EditableList/CellRenderers/ConstText.rb +23 -0
- data/lib/ListHolder/EditableList/CellRenderers/Pixbuf.rb +18 -0
- data/lib/ListHolder/EditableList/CellRenderers/Progress.rb +36 -0
- data/lib/ListHolder/EditableList/CellRenderers/Text.rb +51 -0
- data/lib/ListHolder/EditableList/CellRenderers/Toggle.rb +35 -0
- data/lib/ListHolder/EditableList/Column.rb +223 -0
- data/lib/ListHolder/EditableList/DrbListModel.rb +809 -0
- data/lib/ListHolder/EditableList/ListPrintOperation/ColumnsHeaderLayout.rb +56 -0
- data/lib/ListHolder/EditableList/ListPrintOperation/CustomPageSetup.rb +100 -0
- data/lib/ListHolder/EditableList/ListPrintOperation/FooterLayout.rb +26 -0
- data/lib/ListHolder/EditableList/ListPrintOperation/HeaderLayout.rb +35 -0
- data/lib/ListHolder/EditableList/ListPrintOperation/IterLayout.rb +89 -0
- data/lib/ListHolder/EditableList/ListPrintOperation.rb +365 -0
- data/lib/ListHolder/EditableList.rb +309 -0
- data/lib/ListHolder/GanttHolder/Gantt/Rectangle.rb +290 -0
- data/lib/ListHolder/GanttHolder/Gantt.rb +317 -0
- data/lib/ListHolder/GanttHolder/GanttFooter.rb +27 -0
- data/lib/ListHolder/GanttHolder/GanttScaler.rb +60 -0
- data/lib/ListHolder/GanttHolder.rb +31 -0
- data/lib/ListHolder/HistoryWindow.rb +63 -0
- data/lib/ListHolder/ListButtonHolder/ArchiveButton.rb +37 -0
- data/lib/ListHolder/ListButtonHolder/ButtonGroup.rb +32 -0
- data/lib/ListHolder/ListButtonHolder/FilterButton.rb +28 -0
- data/lib/ListHolder/ListButtonHolder/ListButton.rb +305 -0
- data/lib/ListHolder/ListButtonHolder/OrderingButton.rb +26 -0
- data/lib/ListHolder/ListButtonHolder/SumPanelButton.rb +23 -0
- data/lib/ListHolder/ListButtonHolder.rb +94 -0
- data/lib/ListHolder/ListPanel/ListFilter/FRenderer/Combo.rb +94 -0
- data/lib/ListHolder/ListPanel/ListFilter/FRenderer/ConstCombo.rb +11 -0
- data/lib/ListHolder/ListPanel/ListFilter/FRenderer/Text.rb +26 -0
- data/lib/ListHolder/ListPanel/ListFilter/FRenderer/Toggle.rb +41 -0
- data/lib/ListHolder/ListPanel/ListFilter/FRenderer.rb +58 -0
- data/lib/ListHolder/ListPanel/ListFilter.rb +42 -0
- data/lib/ListHolder/ListPanel/ListSum/Text.rb +32 -0
- data/lib/ListHolder/ListPanel/ListSum.rb +72 -0
- data/lib/ListHolder/ListPanel.rb +60 -0
- data/lib/ListHolder.rb +241 -0
- data/lib/LoginWindow.rb +77 -0
- data/lib/MainRouter.rb +64 -0
- data/lib/ManqodCommon.rb +295 -0
- data/lib/ManqodHelp/FormatEditor/FormatJustificationWidget.rb +76 -0
- data/lib/ManqodHelp/FormatsEditor.rb +139 -0
- data/lib/ManqodHelp/HelpBrowser/FormatTagTable/FormatTag.rb +84 -0
- data/lib/ManqodHelp/HelpBrowser/FormatTagTable.rb +39 -0
- data/lib/ManqodHelp/HelpBrowser.rb +135 -0
- data/lib/ManqodHelp/HelpIndex.rb +62 -0
- data/lib/ManqodHelp/HelpToolbar.rb +16 -0
- data/lib/ManqodHelp.rb +120 -0
- data/lib/ManqodRPC.rb +37 -0
- data/lib/Memcache.rb +82 -0
- data/lib/MyConfig.rb +93 -0
- data/lib/Print/PrintItem/TextLayout.rb +47 -0
- data/lib/Print/PrintItem.rb +240 -0
- data/lib/Print.rb +199 -0
- data/lib/PrintEditor/ItemInfo/ItemImage.rb +30 -0
- data/lib/PrintEditor/ItemInfo/ItemList.rb +44 -0
- data/lib/PrintEditor/ItemInfo/ItemTextAlignment.rb +27 -0
- data/lib/PrintEditor/ItemInfo.rb +129 -0
- data/lib/PrintEditor/PageLayout.rb +91 -0
- data/lib/PrintEditor/PrintEditorItem.rb +310 -0
- data/lib/PrintEditor.rb +195 -0
- data/lib/RelationBuilder/RTable/RField.rb +91 -0
- data/lib/RelationBuilder/RTable.rb +293 -0
- data/lib/RelationBuilder/Relation/RelationHandle.rb +70 -0
- data/lib/RelationBuilder/Relation.rb +161 -0
- data/lib/RelationBuilder/RunQuery.rb +55 -0
- data/lib/RelationBuilder/SearchWindow.rb +72 -0
- data/lib/RelationBuilder.rb +468 -0
- data/lib/SB/ListProgress.rb +150 -0
- data/lib/SB/Messaging.rb +77 -0
- data/lib/SB.rb +29 -0
- data/lib/mynotebook.rb +131 -0
- data/lib/mytouchwindow.rb +162 -0
- data/lib/mywindow.rb +134 -0
- data/lib/wysiwyg-print-label.rb +57 -0
- metadata +231 -0
@@ -0,0 +1,468 @@
|
|
1
|
+
#this file is part of manqod
|
2
|
+
#manqod is distributed under the CDDL licence
|
3
|
+
#the author of manqod is Dobai-Pataky Balint(dpblnt@gmail.com)
|
4
|
+
|
5
|
+
class RelationBuilder < Gtk::ScrolledWindow
|
6
|
+
include ManqodCommon
|
7
|
+
include Observable
|
8
|
+
def initialize(show_only_query=false)
|
9
|
+
@img_unique=Gdk::Pixdata.deserialize([71, 100, 107, 80, 0, 0, 1, 216, 2, 1, 0, 2, 0, 0, 0, 64, 0, 0, 0, 16, 0, 0, 0, 16, 145, 0, 0, 0, 0, 142, 102, 102, 102, 255, 130, 0, 0, 0, 0, 1, 102, 102, 102, 255, 131, 153, 153, 204, 255, 1, 102, 102, 102, 255, 136, 153, 153, 204, 255, 1, 102, 102, 102, 255, 130, 0, 0, 0, 0, 1, 102, 102, 102, 255, 131, 153, 153, 204, 255, 1, 102, 102, 102, 255, 136, 153, 153, 204, 255, 1, 102, 102, 102, 255, 130, 0, 0, 0, 0, 142, 102, 102, 102, 255, 130, 0, 0, 0, 0, 1, 102, 102, 102, 255, 131, 255, 255, 255, 255, 1, 102, 102, 102, 255, 136, 255, 255, 255, 255, 1, 102, 102, 102, 255, 130, 0, 0, 0, 0, 3, 102, 102, 102, 255, 255, 255, 255, 255, 0, 0, 0, 255, 130, 255, 255, 255, 255, 130, 204, 0, 0, 255, 131, 255, 255, 255, 255, 130, 204, 0, 0, 255, 2, 255, 255, 255, 255, 102, 102, 102, 255, 130, 0, 0, 0, 0, 1, 102, 102, 102, 255, 132, 255, 255, 255, 255, 130, 204, 0, 0, 255, 131, 255, 255, 255, 255, 130, 204, 0, 0, 255, 2, 255, 255, 255, 255, 102, 102, 102, 255, 130, 0, 0, 0, 0, 3, 102, 102, 102, 255, 255, 255, 255, 255, 0, 0, 0, 255, 130, 255, 255, 255, 255, 130, 204, 0, 0, 255, 131, 255, 255, 255, 255, 130, 204, 0, 0, 255, 2, 255, 255, 255, 255, 102, 102, 102, 255, 130, 0, 0, 0, 0, 1, 102, 102, 102, 255, 132, 255, 255, 255, 255, 130, 204, 0, 0, 255, 131, 255, 255, 255, 255, 130, 204, 0, 0, 255, 2, 255, 255, 255, 255, 102, 102, 102, 255, 130, 0, 0, 0, 0, 3, 102, 102, 102, 255, 255, 255, 255, 255, 0, 0, 0, 255, 130, 255, 255, 255, 255, 130, 204, 0, 0, 255, 131, 255, 255, 255, 255, 130, 204, 0, 0, 255, 2, 255, 255, 255, 255, 102, 102, 102, 255, 130, 0, 0, 0, 0, 1, 102, 102, 102, 255, 132, 255, 255, 255, 255, 135, 204, 0, 0, 255, 2, 255, 255, 255, 255, 102, 102, 102, 255, 130, 0, 0, 0, 0, 6, 102, 102, 102, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 102, 102, 102, 255, 255, 255, 255, 255, 133, 204, 0, 0, 255, 130, 255, 255, 255, 255, 1, 102, 102, 102, 255, 130, 0, 0, 0, 0, 1, 102, 102, 102, 255, 131, 255, 255, 255, 255, 1, 102, 102, 102, 255, 136, 255, 255, 255, 255, 1, 102, 102, 102, 255, 130, 0, 0, 0, 0, 142, 102, 102, 102, 255, 145, 0, 0, 0, 0]).to_pixbuf(true)
|
10
|
+
@img_index=Gdk::Pixdata.deserialize([71, 100, 107, 80, 0, 0, 2, 106, 2, 1, 0, 2, 0, 0, 0, 64, 0, 0, 0, 16, 0, 0, 0, 16, 145, 0, 0, 0, 0, 142, 102, 102, 102, 255, 130, 0, 0, 0, 0, 1, 102, 102, 102, 255, 131, 153, 153, 204, 255, 1, 102, 102, 102, 255, 132, 153, 153, 204, 255, 5, 128, 128, 128, 255, 255, 255, 255, 255, 255, 255, 153, 255, 255, 204, 51, 255, 0, 0, 0, 255, 130, 0, 0, 0, 0, 1, 102, 102, 102, 255, 131, 153, 153, 204, 255, 1, 102, 102, 102, 255, 131, 153, 153, 204, 255, 4, 128, 128, 128, 255, 255, 255, 255, 255, 255, 255, 153, 255, 255, 204, 51, 255, 130, 0, 0, 0, 255, 130, 0, 0, 0, 0, 135, 102, 102, 102, 255, 4, 128, 128, 128, 255, 255, 255, 255, 255, 255, 255, 153, 255, 255, 204, 51, 255, 130, 0, 0, 0, 255, 1, 102, 102, 102, 255, 130, 0, 0, 0, 0, 1, 102, 102, 102, 255, 131, 255, 255, 255, 255, 1, 102, 102, 102, 255, 130, 255, 255, 255, 255, 3, 128, 128, 128, 255, 255, 255, 153, 255, 255, 204, 51, 255, 130, 0, 0, 0, 255, 2, 255, 255, 255, 255, 102, 102, 102, 255, 130, 0, 0, 0, 0, 9, 102, 102, 102, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 102, 102, 102, 255, 255, 255, 255, 255, 128, 128, 128, 255, 255, 255, 255, 255, 255, 204, 51, 255, 130, 0, 0, 0, 255, 130, 255, 255, 255, 255, 1, 102, 102, 102, 255, 130, 0, 0, 0, 0, 1, 102, 102, 102, 255, 131, 255, 255, 255, 255, 3, 102, 102, 102, 255, 128, 128, 128, 255, 255, 255, 255, 255, 133, 255, 204, 51, 255, 130, 0, 0, 0, 255, 130, 0, 0, 0, 0, 5, 102, 102, 102, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 102, 102, 102, 255, 132, 0, 0, 0, 255, 2, 255, 255, 255, 255, 255, 204, 51, 255, 130, 0, 0, 0, 255, 1, 102, 102, 102, 255, 130, 0, 0, 0, 0, 1, 102, 102, 102, 255, 131, 255, 255, 255, 255, 1, 102, 102, 102, 255, 130, 255, 255, 255, 255, 3, 128, 128, 128, 255, 255, 255, 255, 255, 255, 204, 51, 255, 130, 0, 0, 0, 255, 2, 255, 255, 255, 255, 102, 102, 102, 255, 130, 0, 0, 0, 0, 9, 102, 102, 102, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 102, 102, 102, 255, 255, 255, 255, 255, 128, 128, 128, 255, 255, 255, 255, 255, 255, 204, 51, 255, 130, 0, 0, 0, 255, 130, 255, 255, 255, 255, 1, 102, 102, 102, 255, 130, 0, 0, 0, 0, 1, 102, 102, 102, 255, 131, 255, 255, 255, 255, 1, 102, 102, 102, 255, 130, 255, 255, 255, 255, 1, 255, 204, 51, 255, 130, 0, 0, 0, 255, 131, 255, 255, 255, 255, 1, 102, 102, 102, 255, 130, 0, 0, 0, 0, 7, 102, 102, 102, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 102, 102, 102, 255, 255, 255, 255, 255, 255, 204, 51, 255, 130, 0, 0, 0, 255, 132, 255, 255, 255, 255, 1, 102, 102, 102, 255, 130, 0, 0, 0, 0, 1, 102, 102, 102, 255, 131, 255, 255, 255, 255, 2, 102, 102, 102, 255, 255, 255, 255, 255, 130, 0, 0, 0, 255, 133, 255, 255, 255, 255, 1, 102, 102, 102, 255, 130, 0, 0, 0, 0, 142, 102, 102, 102, 255, 145, 0, 0, 0, 0]).to_pixbuf(true)
|
11
|
+
@img_primary=Gdk::Pixdata.deserialize([71, 100, 107, 80, 0, 0, 2, 190, 2, 1, 0, 2, 0, 0, 0, 64, 0, 0, 0, 16, 0, 0, 0, 16, 145, 0, 0, 0, 0, 135, 102, 102, 102, 255, 133, 0, 0, 0, 255, 130, 102, 102, 102, 255, 130, 0, 0, 0, 0, 1, 102, 102, 102, 255, 131, 153, 153, 204, 255, 10, 102, 102, 102, 255, 153, 153, 204, 255, 0, 0, 0, 255, 230, 184, 0, 255, 234, 187, 0, 255, 240, 192, 0, 255, 245, 196, 0, 255, 250, 200, 0, 255, 0, 0, 0, 255, 102, 102, 102, 255, 130, 0, 0, 0, 0, 1, 102, 102, 102, 255, 131, 153, 153, 204, 255, 7, 102, 102, 102, 255, 0, 0, 0, 255, 232, 186, 0, 255, 234, 187, 0, 255, 238, 190, 0, 255, 0, 0, 0, 255, 249, 199, 0, 255, 130, 254, 203, 0, 255, 1, 0, 0, 0, 255, 130, 0, 0, 0, 0, 133, 102, 102, 102, 255, 3, 0, 0, 0, 255, 236, 189, 0, 255, 238, 190, 0, 255, 131, 244, 195, 0, 255, 3, 252, 202, 0, 255, 249, 199, 0, 255, 0, 0, 0, 255, 130, 0, 0, 0, 0, 1, 102, 102, 102, 255, 131, 255, 255, 255, 255, 10, 102, 102, 102, 255, 255, 255, 255, 255, 0, 0, 0, 255, 251, 201, 0, 255, 253, 202, 0, 255, 245, 196, 0, 255, 239, 191, 0, 255, 234, 187, 0, 255, 0, 0, 0, 255, 102, 102, 102, 255, 130, 0, 0, 0, 0, 5, 102, 102, 102, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 102, 102, 102, 255, 130, 255, 255, 255, 255, 7, 0, 0, 0, 255, 250, 200, 0, 255, 243, 194, 0, 255, 236, 189, 0, 255, 0, 0, 0, 255, 255, 255, 255, 255, 102, 102, 102, 255, 130, 0, 0, 0, 0, 1, 102, 102, 102, 255, 131, 255, 255, 255, 255, 1, 102, 102, 102, 255, 131, 255, 255, 255, 255, 3, 0, 0, 0, 255, 241, 193, 0, 255, 0, 0, 0, 255, 130, 255, 255, 255, 255, 1, 102, 102, 102, 255, 130, 0, 0, 0, 0, 6, 102, 102, 102, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 102, 102, 102, 255, 255, 255, 255, 255, 130, 0, 0, 0, 255, 3, 249, 199, 0, 255, 242, 194, 0, 255, 0, 0, 0, 255, 130, 255, 255, 255, 255, 1, 102, 102, 102, 255, 130, 0, 0, 0, 0, 1, 102, 102, 102, 255, 131, 255, 255, 255, 255, 1, 102, 102, 102, 255, 131, 255, 255, 255, 255, 3, 0, 0, 0, 255, 243, 194, 0, 255, 0, 0, 0, 255, 130, 255, 255, 255, 255, 1, 102, 102, 102, 255, 130, 0, 0, 0, 0, 6, 102, 102, 102, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 102, 102, 102, 255, 255, 255, 255, 255, 130, 0, 0, 0, 255, 3, 250, 200, 0, 255, 245, 196, 0, 255, 0, 0, 0, 255, 130, 255, 255, 255, 255, 1, 102, 102, 102, 255, 130, 0, 0, 0, 0, 1, 102, 102, 102, 255, 131, 255, 255, 255, 255, 1, 102, 102, 102, 255, 131, 255, 255, 255, 255, 3, 0, 0, 0, 255, 247, 198, 0, 255, 0, 0, 0, 255, 130, 255, 255, 255, 255, 1, 102, 102, 102, 255, 130, 0, 0, 0, 0, 6, 102, 102, 102, 255, 255, 255, 255, 255, 0, 0, 0, 255, 255, 255, 255, 255, 102, 102, 102, 255, 255, 255, 255, 255, 130, 0, 0, 0, 255, 3, 252, 202, 0, 255, 248, 198, 0, 255, 0, 0, 0, 255, 130, 255, 255, 255, 255, 1, 102, 102, 102, 255, 130, 0, 0, 0, 0, 1, 102, 102, 102, 255, 131, 255, 255, 255, 255, 1, 102, 102, 102, 255, 131, 255, 255, 255, 255, 3, 0, 0, 0, 255, 249, 199, 0, 255, 0, 0, 0, 255, 130, 255, 255, 255, 255, 1, 102, 102, 102, 255, 130, 0, 0, 0, 0, 137, 102, 102, 102, 255, 1, 0, 0, 0, 255, 132, 102, 102, 102, 255, 145, 0, 0, 0, 0]).to_pixbuf(true)
|
12
|
+
@field_style={
|
13
|
+
'tinyint'=>Gtk::Style.new.set_bg(Gtk::STATE_NORMAL,0x4000,0x5700,0xdd00),
|
14
|
+
'int'=>Gtk::Style.new.set_bg(Gtk::STATE_NORMAL,0x4000,0xa500,0xdd00),
|
15
|
+
'bigint'=>Gtk::Style.new.set_bg(Gtk::STATE_NORMAL,0x4000,0xd800,0xdd00),
|
16
|
+
'double'=>Gtk::Style.new.set_bg(Gtk::STATE_NORMAL,0x5800,0xdd00,0x4000),
|
17
|
+
'float'=>Gtk::Style.new.set_bg(Gtk::STATE_NORMAL,0x4000,0xdd00,0x6600),
|
18
|
+
'char'=>Gtk::Style.new.set_bg(Gtk::STATE_NORMAL,0xdd00,0x4000,0xd200),
|
19
|
+
'tinytext'=>Gtk::Style.new.set_bg(Gtk::STATE_NORMAL,0xdd00,0xd400,0x0000),
|
20
|
+
'text'=>Gtk::Style.new.set_bg(Gtk::STATE_NORMAL,0xdd00,0xd400,0x4000),
|
21
|
+
'varchar'=>Gtk::Style.new.set_bg(Gtk::STATE_NORMAL,0xef00,0xe300,0x1400),
|
22
|
+
'date'=>Gtk::Style.new.set_bg(Gtk::STATE_NORMAL,0xc000,0xb000,0x4000),
|
23
|
+
'datetime'=>Gtk::Style.new.set_bg(Gtk::STATE_NORMAL,0xef00,0xb000,0x1000),
|
24
|
+
}
|
25
|
+
@field_style.each_value{|fs|
|
26
|
+
norm=fs.bg(Gtk::STATE_NORMAL)
|
27
|
+
fs.set_bg(Gtk::STATE_ACTIVE,norm.red,norm.green,norm.blue)
|
28
|
+
fs.set_bg(Gtk::STATE_PRELIGHT,
|
29
|
+
norm.red + 0x1000,
|
30
|
+
norm.green+ 0x1000,
|
31
|
+
norm.blue + 0x1000)
|
32
|
+
}
|
33
|
+
|
34
|
+
super()
|
35
|
+
@base_object=nil
|
36
|
+
@rel_ed=Array.new
|
37
|
+
@relations=Array.new
|
38
|
+
@tables=Hash.new
|
39
|
+
@holder=Gtk::VBox.new
|
40
|
+
@widget=Gtk::Fixed.new
|
41
|
+
@widget.signal_connect("expose-event"){|me,ev| draw_focused;draw_relations; true}
|
42
|
+
# @scroller=Gtk::ScrolledWindow.new
|
43
|
+
# add(@scroller.add(@viewport=Gtk::Viewport.new(@scroller.hadjustment,@scroller.vadjustment).add(@widget)))
|
44
|
+
add_with_viewport(@eb=Gtk::EventBox.new.add(@widget))
|
45
|
+
visible_window=false
|
46
|
+
|
47
|
+
@eb.signal_connect('button-press-event'){|me,ev|
|
48
|
+
if ev.button == 2
|
49
|
+
@dragging = true
|
50
|
+
@xshift=ev.x
|
51
|
+
@yshift=ev.y
|
52
|
+
end
|
53
|
+
if ev.button == 3
|
54
|
+
if @rel_ed_status == :start
|
55
|
+
rel_edit(nil,:cancel)
|
56
|
+
else
|
57
|
+
menu=Gtk::Menu.new
|
58
|
+
menu.append(newt=Gtk::ImageMenuItem.new("create table").set_image(Gtk::Image.new(Gtk::Stock::NEW,Gtk::IconSize::MENU)))
|
59
|
+
newt.signal_connect("activate"){|me|
|
60
|
+
dialog=Gtk::MessageDialog.new(nil,Gtk::Dialog::Flags::MODAL,Gtk::MessageDialog::QUESTION,Gtk::MessageDialog::ButtonsType::OK_CANCEL,"creating table")
|
61
|
+
dialog.vbox.pack_start(Gtk::Label.new("table name"))
|
62
|
+
dialog.vbox.pack_start(table_name=Gtk::Entry.new)
|
63
|
+
dialog.show_all
|
64
|
+
if dialog.run == Gtk::Dialog::ResponseType::OK
|
65
|
+
client.query("CREATE TABLE `#{table_name.text}` (`id` BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE = MYISAM")
|
66
|
+
query("insert into tables set name='#{table_name.text}'")
|
67
|
+
if trow=qrow("select * from tables where name='#{table_name.text}'")
|
68
|
+
@tables[trow["name"]]=RTable.new(self,trow["name"],trow["id"],@widget.pointer[0],@widget.pointer[1]).show_me
|
69
|
+
@widget.show_all
|
70
|
+
end
|
71
|
+
end
|
72
|
+
dialog.destroy
|
73
|
+
|
74
|
+
}
|
75
|
+
|
76
|
+
#add tables to the menu
|
77
|
+
menu.append(a=Gtk::ImageMenuItem.new("add existing table").set_image(Gtk::Image.new(Gtk::Stock::OPEN,Gtk::IconSize::MENU)))
|
78
|
+
a.set_submenu(Gtk::Menu.new)
|
79
|
+
client.query("show tables").each{|row|
|
80
|
+
#row2=qrow("select count(id) as c from tables where name='#{row[0]}'")
|
81
|
+
#if row2["c"]=="0"
|
82
|
+
unless @tables.has_key?(row[0])
|
83
|
+
a.submenu.append(tn=Gtk::ImageMenuItem.new(row[0],false).set_image(Gtk::Image.new(Gtk::Stock::ADD,Gtk::IconSize::MENU)))
|
84
|
+
|
85
|
+
tn.signal_connect("activate",row[0],menu){|me,table_name,menu|
|
86
|
+
#add the table
|
87
|
+
add_existing_table(table_name)
|
88
|
+
menu.destroy
|
89
|
+
}
|
90
|
+
end
|
91
|
+
}
|
92
|
+
|
93
|
+
menu.show_all
|
94
|
+
menu.popup(nil,nil,ev.button,ev.time)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
true
|
98
|
+
}
|
99
|
+
@eb.signal_connect('button-release-event'){|me,ev|
|
100
|
+
@dragging=false if @dragging
|
101
|
+
true
|
102
|
+
}
|
103
|
+
@eb.signal_connect('motion-notify-event'){|me,event|
|
104
|
+
# p "moving: #{px}(#{@x}) #{py}(#{@y}) H:#{hadjustment.lower} #{hadjustment.upper} V:#{vadjustment.lower} #{vadjustment.upper}"
|
105
|
+
# ch=false
|
106
|
+
if @dragging
|
107
|
+
px=@xshift - self.pointer[0]
|
108
|
+
py=@yshift - self.pointer[1]
|
109
|
+
px=hadjustment.lower if px < hadjustment.lower
|
110
|
+
py=vadjustment.lower if py < hadjustment.lower
|
111
|
+
px=hadjustment.upper - hadjustment.page_size if px > hadjustment.upper - hadjustment.page_size
|
112
|
+
py=vadjustment.upper - vadjustment.page_size if py > vadjustment.upper - vadjustment.page_size
|
113
|
+
hadjustment.value=px
|
114
|
+
vadjustment.value=py
|
115
|
+
end
|
116
|
+
true
|
117
|
+
}
|
118
|
+
|
119
|
+
@rel_ed_status=nil
|
120
|
+
@dragging=false
|
121
|
+
signal_connect("realize"){|me| @base_object.center_on_me unless @base_object.nil?}
|
122
|
+
|
123
|
+
@show_only_query=show_only_query
|
124
|
+
end
|
125
|
+
attr_reader :focused_item, :tables, :relations, :widget, :rel_ed_status, :holder
|
126
|
+
attr_reader :img_unique, :img_index, :img_primary, :field_style, :show_only_query
|
127
|
+
|
128
|
+
def table_by_name(table_name)
|
129
|
+
tables[table_name]
|
130
|
+
end
|
131
|
+
|
132
|
+
def table_by_id(table_id)
|
133
|
+
found=nil
|
134
|
+
@tables.each{|table_name,tableo|
|
135
|
+
if tableo.table_id.to_i == table_id.to_i
|
136
|
+
found=tableo
|
137
|
+
break
|
138
|
+
end
|
139
|
+
}
|
140
|
+
found
|
141
|
+
end
|
142
|
+
def relation_by_id(rel_id)
|
143
|
+
found=nil
|
144
|
+
@relations.each{|rel|
|
145
|
+
if rel.relation_id.to_i == rel_id.to_i
|
146
|
+
found=rel
|
147
|
+
break
|
148
|
+
end
|
149
|
+
}
|
150
|
+
found
|
151
|
+
end
|
152
|
+
|
153
|
+
def update(notifier=nil)
|
154
|
+
reload #(notifier.target)
|
155
|
+
@search_window.update(get_ancestor(Gtk::Window))
|
156
|
+
@rq_window.update(get_ancestor(Gtk::Window))
|
157
|
+
end
|
158
|
+
|
159
|
+
def reload(target=nil)
|
160
|
+
@search_window=SearchWindow.new(self) unless @search_window
|
161
|
+
@rq_window=RunQuery.new(self) unless @rq_window
|
162
|
+
|
163
|
+
rows("select * from tables"){|row|
|
164
|
+
@tables[row["name"]]=RTable.new(self,row["name"],row["id"],row["rbx"].to_f,row["rby"].to_f)
|
165
|
+
}
|
166
|
+
rows("select * from relations"){|row|
|
167
|
+
r1=tables[row["src_table"]].fields[row["src_field"]] if tables.has_key?(row["src_table"])
|
168
|
+
r2=tables[row["dst_table"]].fields[row["dst_field"]] if tables.has_key?(row["dst_table"])
|
169
|
+
@relations.push(r=Relation.new(self,r1,r2,row['rel_name'],row["rel_type"],row["id"],row["rbx"].to_f,row["rby"].to_f,row['rel_custom']))
|
170
|
+
}
|
171
|
+
review_all
|
172
|
+
end
|
173
|
+
|
174
|
+
def review_all
|
175
|
+
if @show_only_query
|
176
|
+
#show only related to query
|
177
|
+
@tables.each_value{|table| table.set_visibility(false)}
|
178
|
+
@relations.each{|rel| rel.set_visibility(rel.active?)}
|
179
|
+
@relations.each{|rel|
|
180
|
+
if rel.active?
|
181
|
+
rel.rfield1.table.show_neighbours
|
182
|
+
rel.rfield2.table.show_neighbours
|
183
|
+
end
|
184
|
+
}
|
185
|
+
@base_object.show_neighbours if @base_object
|
186
|
+
# @relations.each{|rel|
|
187
|
+
# rel.set_visibility(rel.rfield1.table.shown? && rel.rfield2.table.shown?)
|
188
|
+
# }
|
189
|
+
else
|
190
|
+
#show all
|
191
|
+
@tables.each_value{|table| table.set_visibility(true)}
|
192
|
+
@relations.each{|rel| rel.set_visibility(true)}
|
193
|
+
end
|
194
|
+
clear
|
195
|
+
end
|
196
|
+
|
197
|
+
def title
|
198
|
+
"Relation Builder on #{manqod_db}"
|
199
|
+
end
|
200
|
+
def inspect
|
201
|
+
title
|
202
|
+
end
|
203
|
+
def to_s
|
204
|
+
inspect
|
205
|
+
end
|
206
|
+
|
207
|
+
def set_focused_item(item)
|
208
|
+
return if @focused_item == item
|
209
|
+
if !@focused_item.nil?
|
210
|
+
@focused_item.set_state(Gtk::STATE_NORMAL)
|
211
|
+
@focused_item.dragging=false
|
212
|
+
end
|
213
|
+
@focused_item=item
|
214
|
+
set_focus_child(@focused_item)
|
215
|
+
if !@focused_item.nil?
|
216
|
+
@focused_item.set_state(Gtk::STATE_PRELIGHT)
|
217
|
+
@focused_item.set_has_focus(true)
|
218
|
+
end
|
219
|
+
clear
|
220
|
+
# info.update(focused_item)
|
221
|
+
@focused_item
|
222
|
+
end
|
223
|
+
|
224
|
+
def draw_focused
|
225
|
+
return if @focused_item.nil? || !@focused_item.realized?
|
226
|
+
cr=@widget.window.create_cairo_context
|
227
|
+
x1,y1=@focused_item.widget.translate_coordinates(@widget,0,0)
|
228
|
+
width=@focused_item.widget.allocation.width
|
229
|
+
height=@focused_item.widget.allocation.height
|
230
|
+
|
231
|
+
cr.set_source_rgba(0.2,0.9,0.4,0.4)
|
232
|
+
cr.set_line_width(10)
|
233
|
+
|
234
|
+
cr.rounded_rectangle(x1-10,y1-10,width+20,height+20,20)
|
235
|
+
cr.stroke
|
236
|
+
end
|
237
|
+
|
238
|
+
def draw_relations
|
239
|
+
cr=@widget.window.create_cairo_context
|
240
|
+
@relations.each{|rel|
|
241
|
+
next unless rel.visible? && rel.handle.realized?
|
242
|
+
begin
|
243
|
+
x1=rel.rfield1.table.widget.translate_coordinates(@widget,0,0)[0]
|
244
|
+
y1=rel.rfield1.translate_coordinates(@widget,0,0)[1]
|
245
|
+
x2=rel.rfield2.table.widget.translate_coordinates(@widget,0,0)[0]
|
246
|
+
y2=rel.rfield2.translate_coordinates(@widget,0,0)[1]
|
247
|
+
xr,yr=rel.handle.translate_coordinates(@widget,0,0)
|
248
|
+
if x1<x2
|
249
|
+
t=x1
|
250
|
+
x1=x2
|
251
|
+
x2=t
|
252
|
+
|
253
|
+
t=y1
|
254
|
+
y1=y2
|
255
|
+
y2=t
|
256
|
+
|
257
|
+
w2,w1,wr=[rel.rfield1.table_width, rel.rfield2.table_width, rel.handle.allocation.width]
|
258
|
+
else
|
259
|
+
w1,w2,wr=[rel.rfield1.table_width, rel.rfield2.table_width, rel.handle.allocation.width]
|
260
|
+
end
|
261
|
+
high=(@focused_item == rel.rfield1.table) || (@focused_item == rel.rfield2.table)
|
262
|
+
rescue
|
263
|
+
x1=nil
|
264
|
+
end
|
265
|
+
unless x1.nil?
|
266
|
+
y1+=rel.rfield1.allocation.height/2 #vertical midle of field1
|
267
|
+
y2+=rel.rfield2.allocation.height/2 #vertical middle of field2
|
268
|
+
yr+=rel.handle.allocation.height/2 #vertical middle of relation_handle
|
269
|
+
xr+=rel.handle.allocation.width/2 #horizontal middle of relation_handle
|
270
|
+
m1,m2=[0,0]
|
271
|
+
|
272
|
+
# f1=Math.atan(1.0*(yr-y1)/(x1-xr))
|
273
|
+
# f2=Math.atan(1.0*(yr-y2)/(x2-xr))
|
274
|
+
# f3=(f1+f2)/2
|
275
|
+
|
276
|
+
if x1+w1/2 < xr
|
277
|
+
x1+=w1
|
278
|
+
d1=1
|
279
|
+
m1=x1-xr
|
280
|
+
else
|
281
|
+
m1=xr-x1
|
282
|
+
d1=-1
|
283
|
+
end
|
284
|
+
|
285
|
+
if x2+w2/2 < xr
|
286
|
+
x2+=w2
|
287
|
+
m2=x2-xr
|
288
|
+
d2=1
|
289
|
+
else
|
290
|
+
m2=xr-x2
|
291
|
+
d2=-1
|
292
|
+
end
|
293
|
+
|
294
|
+
f1=Math.atan(1.0*(yr-y1)/(x1-xr))
|
295
|
+
f1=f1-Math::PI if xr>x1
|
296
|
+
|
297
|
+
f2=Math.atan(1.0*(yr-y2)/(x2-xr))
|
298
|
+
f2=f2-Math::PI if xr>x2
|
299
|
+
|
300
|
+
f3=(f1+f2)/2+Math::PI/2
|
301
|
+
# f3=f3-Math::PI if xr>x1 && x1<x2 || x1>x2 && xr>x2
|
302
|
+
|
303
|
+
r1=((x1-xr).abs+(yr-y1).abs)/2
|
304
|
+
r2=((x2-xr).abs+(yr-y2).abs)/2
|
305
|
+
|
306
|
+
#draw highlighted
|
307
|
+
if high
|
308
|
+
cr.set_source_rgba(0.9,0.9,0.2,0.4)
|
309
|
+
cr.set_line_width(8)
|
310
|
+
#arrow
|
311
|
+
cr.move_to(x2+5*(m2<=>0),y2-5)
|
312
|
+
cr.line_to(x2,y2)
|
313
|
+
cr.line_to(x2+5*(m2<=>0),y2+5)
|
314
|
+
#second arrow
|
315
|
+
if rel.rel_type == "o"
|
316
|
+
cr.move_to(x1+5*(m1<=>0),y1-5)
|
317
|
+
cr.line_to(x1,y1)
|
318
|
+
cr.line_to(x1+5*(m1<=>0),y1+5)
|
319
|
+
end
|
320
|
+
#relation
|
321
|
+
cr.move_to(x1,y1)
|
322
|
+
cr.curve_to(x1+r1*d1,y1, xr+r1*Math.cos(f3),yr-r1*Math.sin(f3),xr,yr)
|
323
|
+
|
324
|
+
cr.move_to(x2,y2)
|
325
|
+
cr.curve_to(x2+r2*d2,y2, xr+r2*Math.cos(f3-Math::PI),yr-r2*Math.sin(f3-Math::PI),xr,yr)
|
326
|
+
cr.stroke
|
327
|
+
end
|
328
|
+
|
329
|
+
if rel.active?
|
330
|
+
cr.set_source_rgba(0,0,1,0.8)
|
331
|
+
cr.set_line_width(4)
|
332
|
+
else
|
333
|
+
cr.set_source_rgba(0,0.4,0,0.8)
|
334
|
+
cr.set_line_width(2)
|
335
|
+
end
|
336
|
+
|
337
|
+
#draw arrow
|
338
|
+
cr.move_to(x2+5*d2,y2-5)
|
339
|
+
cr.line_to(x2,y2)
|
340
|
+
cr.line_to(x2+5*d2,y2+5)
|
341
|
+
|
342
|
+
if rel.rel_type == "o"
|
343
|
+
#draw second arrow
|
344
|
+
cr.move_to(x1+5*d1,y1-5)
|
345
|
+
cr.line_to(x1,y1)
|
346
|
+
cr.line_to(x1+5*d1,y1+5)
|
347
|
+
end
|
348
|
+
|
349
|
+
|
350
|
+
cr.move_to(x1,y1)
|
351
|
+
cr.curve_to(x1+r1*d1,y1, xr+r1*Math.cos(f3),yr-r1*Math.sin(f3),xr,yr)
|
352
|
+
|
353
|
+
cr.move_to(x2,y2)
|
354
|
+
cr.curve_to(x2+r2*d2,y2, xr+r2*Math.cos(f3-Math::PI),yr-r2*Math.sin(f3-Math::PI),xr,yr)
|
355
|
+
|
356
|
+
cr.stroke
|
357
|
+
=begin
|
358
|
+
#draw control angle 1
|
359
|
+
cr.set_source_rgba(0.1,0.9,0.1,0.8).set_line_width(0.5).set_dash(5)
|
360
|
+
cr.move_to(xr,yr).line_to(xr+r1*Math.cos(f1),yr-r1*Math.sin(f1))
|
361
|
+
cr.stroke
|
362
|
+
|
363
|
+
#draw control angle 2
|
364
|
+
cr.set_source_rgba(0.1,0.1,0.9,0.8).set_line_width(0.5).set_dash(10)
|
365
|
+
cr.move_to(xr,yr).line_to(xr+r2*Math.cos(f2),yr-r2*Math.sin(f2))
|
366
|
+
cr.stroke
|
367
|
+
|
368
|
+
#draw the control points
|
369
|
+
|
370
|
+
cr.set_dash(100000)
|
371
|
+
|
372
|
+
cr.set_source_rgba(0.9,0.1,0.1,0.4)
|
373
|
+
cr.set_line_width(1)
|
374
|
+
|
375
|
+
cr.move_to(x1,y1)
|
376
|
+
cr.line_to(x1+r1*d1,y1)
|
377
|
+
cr.move_to(xr,yr)
|
378
|
+
cr.line_to(xr+r1*Math.cos(f3),yr-r1*Math.sin(f3))
|
379
|
+
|
380
|
+
cr.stroke
|
381
|
+
cr.set_source_rgba(0.1,0.1,0.9,0.4)
|
382
|
+
|
383
|
+
cr.move_to(x2,y2)
|
384
|
+
cr.line_to(x2+r2*d2,y2)
|
385
|
+
cr.move_to(xr,yr)
|
386
|
+
cr.line_to(xr+r2*Math.cos(f3-Math::PI),yr-r2*Math.sin(f3-Math::PI))
|
387
|
+
|
388
|
+
cr.stroke
|
389
|
+
=end
|
390
|
+
end
|
391
|
+
}
|
392
|
+
end
|
393
|
+
|
394
|
+
def clear
|
395
|
+
@widget.queue_draw_area(0, 0, @widget.allocation.width, @widget.allocation.height)
|
396
|
+
end
|
397
|
+
|
398
|
+
def rel_edit(rfield,status)
|
399
|
+
@rel_ed_status=status
|
400
|
+
# @rel_ed.push(rfield) if rfield.active?
|
401
|
+
case status
|
402
|
+
when :start
|
403
|
+
x1,y1=rfield.translate_coordinates(@widget,0,0)
|
404
|
+
@rel_in_ed=Relation.new(self,rfield,nil,"",nil,nil,x1-30,y1-30)
|
405
|
+
@relations.push(@rel_in_ed)
|
406
|
+
@rel_in_ed.show_me
|
407
|
+
when :finish
|
408
|
+
@rel_in_ed.set_rfield2(rfield)
|
409
|
+
@rel_in_ed.edit
|
410
|
+
@rel_in_ed.show_me
|
411
|
+
when :cancel
|
412
|
+
@rel_in_ed.remove
|
413
|
+
end
|
414
|
+
end
|
415
|
+
|
416
|
+
def find_relation(rfield1,rfield2)
|
417
|
+
rel=nil
|
418
|
+
@relations.each{|r|
|
419
|
+
if [r.rfield1,r.rfield2] == [rfield1,rfield2] or [r.rfield1,r.rfield2] == [rfield2,rfield1]
|
420
|
+
rel=r
|
421
|
+
end
|
422
|
+
}
|
423
|
+
rel
|
424
|
+
end
|
425
|
+
|
426
|
+
def remove_table(table,from_sql=false)
|
427
|
+
@tables[table].fields.each{|field,field_wg|
|
428
|
+
@relations.each{|rel|
|
429
|
+
if rel.rfield1 == field_wg or rel.rfield2 == field_wg
|
430
|
+
edebug("removing #{rel}","relation-builder","debug")
|
431
|
+
rel.remove
|
432
|
+
end
|
433
|
+
}
|
434
|
+
}
|
435
|
+
query("delete from tables where id='#{@tables[table].table_id}'")
|
436
|
+
client.query("drop table `#{table}`") if from_sql
|
437
|
+
@tables[table].widget.destroy
|
438
|
+
@tables.delete(table)
|
439
|
+
changed(@tables[table])
|
440
|
+
end
|
441
|
+
def add_existing_table(table_name)
|
442
|
+
unless @tables.has_key?(table_name)
|
443
|
+
query("insert into tables set name='#{table_name}'")
|
444
|
+
if trow=qrow("select * from tables where name='#{table_name}'")
|
445
|
+
@tables[trow["name"]]=RTable.new(self,trow["name"],trow["id"],@widget.pointer[0],@widget.pointer[1])
|
446
|
+
@tables[trow["name"]].show_me
|
447
|
+
@widget.show_all
|
448
|
+
changed(@tables[trow["name"]])
|
449
|
+
end
|
450
|
+
end
|
451
|
+
end
|
452
|
+
|
453
|
+
def build_query
|
454
|
+
sql=@query_id
|
455
|
+
sql
|
456
|
+
end
|
457
|
+
def set_base_object(new_bo)
|
458
|
+
@base_object=new_bo
|
459
|
+
@base_object.center_on_me
|
460
|
+
end
|
461
|
+
def changed(notifier=nil)
|
462
|
+
edebug("#{notifier} changed, notifying observers","relation-builder","debug")
|
463
|
+
super()
|
464
|
+
notify_observers(self,notifier)
|
465
|
+
end
|
466
|
+
|
467
|
+
end
|
468
|
+
|
@@ -0,0 +1,150 @@
|
|
1
|
+
#this file is part of manqod
|
2
|
+
#manqod is distributed under the CDDL licence
|
3
|
+
#the author of manqod is Dobai-Pataky Balint(dpblnt@gmail.com)
|
4
|
+
|
5
|
+
class MyListProgress < Gtk::ProgressBar
|
6
|
+
def initialize
|
7
|
+
@counter=0.0
|
8
|
+
@max=nil
|
9
|
+
@visible_steps=1
|
10
|
+
@progresses=Hash.new
|
11
|
+
@list_name=nil
|
12
|
+
@frac=0
|
13
|
+
@pfrac=0
|
14
|
+
super()
|
15
|
+
# modify_font(Pango::FontDescription.new('Monospace 3'))
|
16
|
+
set_height_request(6)
|
17
|
+
set_width_request(100)
|
18
|
+
set_activity_mode(false)
|
19
|
+
modify_font(Pango::FontDescription.new("sans 7"))
|
20
|
+
# set_show_text(false)
|
21
|
+
@pulse_thread=nil
|
22
|
+
end
|
23
|
+
attr_reader :counter, :max, :visible_steps
|
24
|
+
attr_accessor :done
|
25
|
+
|
26
|
+
def start_pulse
|
27
|
+
@pulse_thread=Thread.new{
|
28
|
+
loop do
|
29
|
+
sleep 0.1
|
30
|
+
Gtk.thread_protect{pulse unless destroyed?}
|
31
|
+
Gtk.show_thread_changes
|
32
|
+
end
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
def zero(new_max,list_name=nil)
|
37
|
+
Thread.kill(@pulse_thread) unless @pulse_thread.nil?
|
38
|
+
@pulse_thread=nil
|
39
|
+
@max=new_max
|
40
|
+
@done=false
|
41
|
+
set_counter(0)
|
42
|
+
if @list_name!=list_name
|
43
|
+
@list_name=list_name
|
44
|
+
Gtk.thread_protect{set_text(@list_name) unless destroyed?}
|
45
|
+
end
|
46
|
+
self
|
47
|
+
end
|
48
|
+
def set_visible_steps(new_vs)
|
49
|
+
@visible_steps=new_vs.to_f
|
50
|
+
self
|
51
|
+
end
|
52
|
+
|
53
|
+
def set_counter(new_counter)
|
54
|
+
new_counter=max if new_counter>max
|
55
|
+
@counter=new_counter.to_f
|
56
|
+
|
57
|
+
if max==0
|
58
|
+
@frac=0
|
59
|
+
else
|
60
|
+
@frac=counter.to_f/max.to_f
|
61
|
+
=begin
|
62
|
+
if counter==0
|
63
|
+
else
|
64
|
+
set_text((100.0*counter/max).round.to_s+"%")
|
65
|
+
end
|
66
|
+
=end
|
67
|
+
end
|
68
|
+
if (@pfrac*100/visible_steps).round!=(@frac*100/visible_steps).round
|
69
|
+
Gtk.thread_protect{set_fraction(@frac) unless destroyed?}
|
70
|
+
Gtk.show_thread_changes
|
71
|
+
@pfrac=@frac
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
77
|
+
class MultiProgress < Gtk::HBox
|
78
|
+
def initialize
|
79
|
+
@max=0
|
80
|
+
super()
|
81
|
+
@progresses=Hash.new
|
82
|
+
signal_connect("destroy"){|me| @progresses.each_value{|progress| progress.destroy} }
|
83
|
+
end
|
84
|
+
|
85
|
+
def pulse(list_id)
|
86
|
+
#init the progress
|
87
|
+
unless @progresses.has_key?(list_id)
|
88
|
+
@progresses[list_id]=MyListProgress.new
|
89
|
+
pack_start(@progresses[list_id])
|
90
|
+
@progresses[list_id].show
|
91
|
+
end
|
92
|
+
SB.instance.show
|
93
|
+
|
94
|
+
@progresses[list_id].start_pulse
|
95
|
+
end
|
96
|
+
|
97
|
+
def zero(list_id,rowcount,list_name=nil,visible_steps=15)
|
98
|
+
#init the progress
|
99
|
+
unless @progresses.has_key?(list_id)
|
100
|
+
@progresses[list_id]=MyListProgress.new
|
101
|
+
@progresses[list_id].set_visible_steps(visible_steps)
|
102
|
+
pack_start(@progresses[list_id])
|
103
|
+
@progresses[list_id].show
|
104
|
+
end
|
105
|
+
|
106
|
+
@progresses[list_id].zero(rowcount,list_name) unless @progresses[list_id].destroyed?
|
107
|
+
SB.instance.show
|
108
|
+
self
|
109
|
+
end
|
110
|
+
|
111
|
+
def step(list_id,new_value)
|
112
|
+
if @progresses.has_key?(list_id)
|
113
|
+
@progresses[list_id].set_counter(new_value) unless @progresses[list_id].destroyed?
|
114
|
+
SB.instance.show unless SB.instance.visible?
|
115
|
+
end
|
116
|
+
# sleep 0.1
|
117
|
+
self
|
118
|
+
end
|
119
|
+
|
120
|
+
def done(list_id)
|
121
|
+
@progresses[list_id].done=true if @progresses.has_key?(list_id)
|
122
|
+
if all_done?
|
123
|
+
@progresses.each_value{|progress|
|
124
|
+
remove(progress)
|
125
|
+
progress.destroy
|
126
|
+
}
|
127
|
+
@progresses.clear
|
128
|
+
end
|
129
|
+
SB.instance.show unless SB.instance.visible?
|
130
|
+
end
|
131
|
+
|
132
|
+
def killed(list_id)
|
133
|
+
if @progresses.has_key?(list_id)
|
134
|
+
pr=@progresses.delete(list_id)
|
135
|
+
remove(pr)
|
136
|
+
pr.destroy
|
137
|
+
p pr.destroyed?
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
def all_done?
|
142
|
+
d=0
|
143
|
+
@progresses.each_value{|progress| d+=1 if progress.done}
|
144
|
+
@progresses.size == d
|
145
|
+
end
|
146
|
+
def to_s
|
147
|
+
"MultiProgress"
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
data/lib/SB/Messaging.rb
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
#this file is part of manqod
|
2
|
+
#manqod is distributed under the CDDL licence
|
3
|
+
#the author of manqod is Dobai-Pataky Balint(dpblnt@gmail.com)
|
4
|
+
|
5
|
+
class Messaging < Gtk::Button
|
6
|
+
class MessageReader < Gtk::Window
|
7
|
+
def initialize
|
8
|
+
super()
|
9
|
+
set_size_request(400,300)
|
10
|
+
set_window_position(Gtk::Window::Position::CENTER_ON_PARENT)
|
11
|
+
set_transient_for(SB.instance.parent_window)
|
12
|
+
set_modal(true)
|
13
|
+
set_title("Message Reader")
|
14
|
+
@mmodel=Gtk::ListStore.new(String,String,String,String,String,String,String)
|
15
|
+
@sorter=Gtk::TreeModelSort.new(@mmodel).set_sort_column_id(0,Gtk::SortType::DESCENDING)
|
16
|
+
add(Gtk::VPaned.new.
|
17
|
+
set_position(170).set_position_set(true).
|
18
|
+
add1(Gtk::ScrolledWindow.new.
|
19
|
+
set_policy(Gtk::POLICY_AUTOMATIC,Gtk::POLICY_AUTOMATIC).
|
20
|
+
add(@list=Gtk::TreeView.new(@sorter))
|
21
|
+
).
|
22
|
+
add2(Gtk::ScrolledWindow.new.
|
23
|
+
set_policy(Gtk::POLICY_AUTOMATIC,Gtk::POLICY_AUTOMATIC).
|
24
|
+
add_with_viewport(@body=Gtk::TextView.new)
|
25
|
+
)
|
26
|
+
)
|
27
|
+
list.append_column(Gtk::TreeViewColumn.new("Date",renderer=Gtk::CellRendererText.new, {:text => 0,:font => 4}).set_sort_column_id(0))
|
28
|
+
list.append_column(Gtk::TreeViewColumn.new("Sender",renderer=Gtk::CellRendererText.new, {:text => 1,:font => 4}).set_sort_column_id(1))
|
29
|
+
list.append_column(Gtk::TreeViewColumn.new("Subject",renderer=Gtk::CellRendererText.new, {:text => 2,:font => 4}).set_sort_column_id(2))
|
30
|
+
list.signal_connect("cursor-changed"){|me|
|
31
|
+
if me.cursor
|
32
|
+
item=@sorter.get_iter(me.cursor[0])
|
33
|
+
si=@sorter.convert_iter_to_child_iter(item)
|
34
|
+
@body.buffer.delete(@body.buffer.bounds[0],@body.buffer.bounds[1])
|
35
|
+
@body.buffer.insert_at_cursor(si[5])
|
36
|
+
if si[3] == "n"
|
37
|
+
ManqodDB.instance.manqod_db.set_message_read(item[6],Nick.instance.get_nick)
|
38
|
+
si[3]="n"
|
39
|
+
si[4]="Verdana 10"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
}
|
43
|
+
|
44
|
+
end
|
45
|
+
attr_reader :list, :body
|
46
|
+
def populate
|
47
|
+
@mmodel.clear
|
48
|
+
ManqodDB.instance.manqod_db.messages(Nick.instance.get_nick).each{|message|
|
49
|
+
i=@mmodel.append
|
50
|
+
i[0]=message["date"]
|
51
|
+
i[1]=message["sender"]
|
52
|
+
i[2]=message["subject"]
|
53
|
+
i[3]=message["state"]
|
54
|
+
i[4]=(message["state"] == "n" ? "Verdana Bold 10" : "Verdana 10")
|
55
|
+
i[5]=message["body"]
|
56
|
+
i[6]=message["id"]
|
57
|
+
}
|
58
|
+
self
|
59
|
+
end
|
60
|
+
end
|
61
|
+
include Singleton
|
62
|
+
def initialize
|
63
|
+
super()
|
64
|
+
set_can_focus(false)
|
65
|
+
set_relief(Gtk::ReliefStyle::NONE)
|
66
|
+
signal_connect('clicked'){|me|
|
67
|
+
MessageReader.new.populate.show_all
|
68
|
+
}
|
69
|
+
end
|
70
|
+
|
71
|
+
def check_messages
|
72
|
+
um=ManqodDB.instance.manqod_db.unread_messages(Nick.instance.get_nick)
|
73
|
+
set_label(um==0?"no":"#{um}" + " messages")
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|