manqod 1.1559.0 → 1.1570.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/Common/Fixnum.rb CHANGED
@@ -10,6 +10,7 @@ class Fixnum
10
10
  ret=String.new(format)
11
11
  ret.sub!("%j","#{d}")
12
12
  ret.sub!("%d","#{d}")
13
+ ret.sub!("%h","#{h + d*24}")
13
14
  ret.sub!("%H","#{"%02d" % h}")
14
15
  ret.sub!("%M","#{"%02d" % m}")
15
16
  ret.sub!("%S","#{"%02d" % s.round}")
@@ -22,7 +22,7 @@ class QBuilder < Gtk::HPaned
22
22
  pack_start(@info=Gtk::Table.new(2,3),false).
23
23
  pack_start(Gtk::ScrolledWindow.new.set_policy(Gtk::PolicyType::AUTOMATIC,Gtk::PolicyType::AUTOMATIC).add_with_viewport(@holder=Gtk::VBox.new(false,0))).
24
24
  pack_start(@controls=Gtk::VBox.new,false,true))
25
- add2(@rb=RelationBuilder.new(true))
25
+ add2(@rb=RelationBuilder.new(false))
26
26
 
27
27
  @info.attach_defaults(Gtk::Label.new("name"),0,1,0,1).attach_defaults(@name=Gtk::Entry.new,1,2,0,1).
28
28
  attach_defaults(Gtk::Label.new("base"),0,1,1,2).attach_defaults(Gtk::HBox.new.pack_start(@base=Gtk::ComboBox.new(Gtk::ListStore.new(Integer,String))).pack_end(@goto_button=Gtk::Button.new.set_image(Gtk::Image.new(Gtk::Stock::JUMP_TO,Gtk::IconSize.from_name(get_conf(0,0,"button-size")))),false,false),1,2,1,2).
@@ -686,6 +686,7 @@ class ListModel
686
686
  end
687
687
 
688
688
  def iter2csv(iter)
689
+ separator=(list.gtk_attribute("csv_field_separator") ? list.gtk_attribute("csv_field_separator") : ',')
689
690
  row=""
690
691
  list.columns.each{|col|
691
692
  case col.header["type"]
@@ -698,7 +699,7 @@ class ListModel
698
699
  else iter[col.colnum].to_s
699
700
  end
700
701
  end
701
- row="#{row}#{ct.to_s},"
702
+ row="#{row}#{ct.to_s}#{separator}"
702
703
  }
703
704
  row="#{row[0..row.length]}\n"
704
705
  end
@@ -706,10 +707,10 @@ class ListModel
706
707
  def to_csv(filename,ids=nil)
707
708
  file = File.new(filename, "wb+")
708
709
  ids=Array.new
709
-
710
+ separator=(list.gtk_attribute("csv_field_separator") ? list.gtk_attribute("csv_field_separator") : ',')
710
711
  row=""
711
712
  list.columns.each{|col|
712
- row="#{row}#{col.header['header']},"
713
+ row="#{row}#{col.header['header']}#{separator}"
713
714
  }
714
715
  file.write("#{row[0..row.length]}\n")
715
716
 
@@ -723,11 +724,14 @@ class ListModel
723
724
  end
724
725
 
725
726
  def from_csv(filename)
726
- header=true
727
+ separator=(list.gtk_attribute("csv_field_separator") ? list.gtk_attribute("csv_field_separator") : ',')
728
+ skip_header_lines=(list.gtk_attribute("csv_skip_header_lines") ? list.gtk_attribute("csv_skip_header_lines").to_i : 1)
729
+ row_counter=0
727
730
  ids=Array.new
728
731
  IO.foreach(filename){|line|
729
- row=line.chomp.split(",")
730
- unless header
732
+ row=line.chomp.split(separator)
733
+ row_counter+=1
734
+ if row_counter > skip_header_lines && row.size>0
731
735
  sql="insert into #{base} set"
732
736
  comma=false
733
737
  #child key auto adding
@@ -755,7 +759,6 @@ class ListModel
755
759
  inserted_id=qrow("select id from #{base} order by id desc limit 1")["id"].to_i
756
760
  ids.push(inserted_id)
757
761
  end
758
- header=false
759
762
  }
760
763
  drbmodel.rows_changed(ids,nick) if ids.size>0
761
764
  edebug("csv loaded","list")
@@ -39,7 +39,7 @@ class ListPrintOperation < Gtk::PrintOperation
39
39
 
40
40
  @header_line_width=(list.gtk_attribute("header_line_width") || 1.0).to_f
41
41
  @footer_line_width=(list.gtk_attribute("footer_line_width") || 1.0).to_f
42
- @cell_line_width=(list.gtk_attribute("cell_line_width") || 0.3).to_f
42
+ @cell_line_width=(list.gtk_attribute("cell_line_width") || 0.1).to_f
43
43
  @sum_line_width=(list.gtk_attribute("sum_line_width") || 0.6).to_f
44
44
 
45
45
  @print_with_gantt=(list.gtk_attribute("print_with_gantt") || "false") == "true"
@@ -270,7 +270,23 @@ class ListPrintOperation < Gtk::PrintOperation
270
270
  cr = context.cairo_context
271
271
  @header.draw(cr)
272
272
  @columns_header.draw(cr)
273
- @child_columns_header.draw(cr) if child_list
273
+ if child_list
274
+ @child_columns_header.draw(cr)
275
+ else
276
+ cr.set_line_width(@cell_line_width)
277
+ lcol=nil
278
+ list.columns.each{|col|
279
+ if col.printable?
280
+ cr.move_to(@column_pos[col.data],@columns_header.y + @columns_header.height + @header_line_width)
281
+ cr.line_to(@column_pos[col.data],@footer.y) #FIXME
282
+ lcol=col
283
+ end
284
+ }
285
+ cr.move_to(@column_pos[lcol.data]+@column_width[lcol.data],@columns_header.y + @columns_header.height + @header_line_width)
286
+ cr.line_to(@column_pos[lcol.data]+@column_width[lcol.data],@footer.y) #FIXME
287
+ cr.stroke
288
+ end
289
+
274
290
  @footer.draw(cr,page_number)
275
291
 
276
292
  #draw cells
@@ -319,8 +335,8 @@ class ListPrintOperation < Gtk::PrintOperation
319
335
  @page_n=@page_n+1
320
336
  end
321
337
  il.set_page(@page_n)
322
- il.set_y(@current_height)
323
- @current_height=@current_height+il.row_height+@row_spacing
338
+ il.set_y(@current_height).set_row_spacing(@row_spacing)
339
+ @current_height=@current_height+il.row_height+2*@row_spacing
324
340
  @iter_layouts.push(il)
325
341
  edebug(il.inspect,"printing")
326
342
  page_full
@@ -8,6 +8,7 @@ class IterLayout
8
8
  @row_height=0
9
9
  @page=0
10
10
  @y=0
11
+ @row_spacing=1
11
12
  @pop=pop
12
13
  @iter=iter.clone
13
14
  @cell_layouts=Hash.new
@@ -23,7 +24,7 @@ class IterLayout
23
24
  text_cell.set_alignment(col.pango_layout_alignment)
24
25
  text_cell.set_wrap(Pango::Layout::WRAP_WORD_CHAR).set_ellipsize(Pango::Layout::ELLIPSIZE_NONE)
25
26
  text_to_display=case col.header["type"]
26
- when "gtk_ordering" then col.path_format(@iter) unless iter.nil?
27
+ when "gtk_ordering" then col.path_format(@iter) if iter && iter.class.name == "Gtk::TreeIter"
27
28
  when "gtk_duration" then (@iter[col.colnum] || 0).to_i.strftime(col.duration_format)
28
29
  when "gtk_timestamp" then Time.at(@iter[col.colnum] || 0).strftime(col.timestamp_format)
29
30
  when "gtk_const_text" then col.renderer.get_display(@iter[col.colnum].to_s)
@@ -72,6 +73,10 @@ class IterLayout
72
73
  @gr.py1=@y if @gr
73
74
  self
74
75
  end
76
+ def set_row_spacing(ns)
77
+ @row_spacing=ns
78
+ self
79
+ end
75
80
  def set_page(page)
76
81
  @page=page
77
82
  end
@@ -148,14 +153,14 @@ class IterLayout
148
153
  cr.set_source_rgba(0.1,0.1,0.1,0.7).set_dash(100000)
149
154
  if @line_above
150
155
  cr.set_line_width(@pop.sum_line_width)
151
- cr.move_to(min_x,y+@crlw)
152
- cr.line_to(max_x,y+@crlw)
156
+ cr.move_to(min_x,y+@crlw-@row_spacing)
157
+ cr.line_to(max_x,y+@crlw-@row_spacing)
153
158
  cr.stroke
154
159
  end
155
160
  if @pop.row_underline>0
156
161
  cr.set_line_width(@pop.row_underline)
157
- cr.move_to(min_x,y+@row_height)
158
- cr.line_to(max_x,y+@row_height)
162
+ cr.move_to(min_x,y+@row_height+@row_spacing)
163
+ cr.line_to(max_x,y+@row_height+@row_spacing)
159
164
  cr.stroke
160
165
  end
161
166
  end
@@ -12,7 +12,14 @@ class MyButton < Gtk::Button
12
12
  @holder=holder
13
13
  @show_icon=if gtk_attribute('show-mode') then gtk_attribute('show-mode') == 'icon only' || gtk_attribute('show-mode') == 'icon and text' || false else true end
14
14
  @show_text=if gtk_attribute('show-mode') then gtk_attribute('show-mode') == 'text only' || gtk_attribute('show-mode') == 'icon and text' || false else true end
15
- @column_of_sensitivity=if gtk_attribute('column-of-sensitivity') then @caller.list.list_model.headers[gtk_attribute('column-of-sensitivity')]["model_col"] else nil end
15
+ @column_of_sensitivity=nil
16
+ if gtk_attribute('column-of-sensitivity')
17
+ if @caller.list.list_model.headers.has_key?(gtk_attribute('column-of-sensitivity'))
18
+ @column_of_sensitivity=@caller.list.list_model.headers[gtk_attribute('column-of-sensitivity')]["model_col"]
19
+ else
20
+ warn("You need to add \"#{gtk_attribute('column-of-sensitivity')}\" as Invisible String to #{@caller.list}")
21
+ end
22
+ end
16
23
  super()
17
24
  set_use_underline(true)
18
25
  set_relief(Gtk::ReliefStyle::NONE)
@@ -205,8 +212,12 @@ class MyButton < Gtk::Button
205
212
  [Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL],
206
213
  [Gtk::Stock::CONVERT, Gtk::Dialog::RESPONSE_ACCEPT])
207
214
  filechooser.set_filename(get_conf(@caller.list.list_id,0,"csvfilename")) unless get_conf(@caller.list.list_id,0,"csvfilename").nil?
208
- filechooser.add_filter(csv=Gtk::FileFilter.new.add_pattern("*.csv").set_name('csv'))
209
- filechooser.set_filter(csv)
215
+ ftype=(@caller.list.gtk_attribute("file_filter") ? @caller.list.gtk_attribute("file_filter").split(",") : ["*.csv"])
216
+ ftt=nil
217
+ ftype.each{|ft|
218
+ filechooser.add_filter(ftt=Gtk::FileFilter.new.add_pattern(ft).set_name(ft))
219
+ }
220
+ filechooser.set_filter(ftt) if ftt
210
221
 
211
222
  if filechooser.run == Gtk::Dialog::RESPONSE_ACCEPT
212
223
  set_conf(@caller.list.list_id,0,"csvfilename",filechooser.filename)
@@ -19,7 +19,7 @@ class SumRendererText < Gtk::Label
19
19
  set_text(case column.header['type']
20
20
  when "gtk_int" then number_format(new_value,@column.decimals_attribute)
21
21
  when "gtk_float" then number_format(new_value,@column.decimals_attribute)
22
- when "gtk_duration" then Time.at(new_value).strftime(column.duration_format)
22
+ when "gtk_duration" then new_value.to_i.strftime(column.duration_format)
23
23
  end)
24
24
  end
25
25
 
@@ -94,14 +94,14 @@ class PrintItem
94
94
  @sum_font=list.gtk_attribute("sum_font") || "verdana bold 6"
95
95
  @cell_font=list.gtk_attribute("cell_font") || "verdana 6"
96
96
  @columns_header_font=list.gtk_attribute("columns_header_font") || "verdana bold 6"
97
- @row_spacing=list.gtk_attribute("row_spacing").to_f || 1.0
98
- @column_spacing=list.gtk_attribute("column_spacing").to_f || 1.0
97
+ @row_spacing=(list.gtk_attribute("row_spacing") || 1.0).to_f
98
+ @column_spacing=(list.gtk_attribute("column_spacing") || 1.0).to_f
99
99
  @draw_header_cell_borders=list.gtk_attribute("draw_header_cell_borders")=="true"
100
100
  @fill_header_background=list.gtk_attribute("fill_header_background")=="true"
101
- @header_line_width=list.gtk_attribute("header_line_width").to_f || 1.0
101
+ @header_line_width=(list.gtk_attribute("header_line_width") || 0.5).to_f
102
102
  @draw_header_line=list.gtk_attribute("draw_header_line") == "true"
103
- @cell_line_width=list.gtk_attribute("cell_line_width").to_f || 0.3
104
- @sum_line_width=list.gtk_attribute("sum_line_width").to_f || 0.6
103
+ @cell_line_width=(list.gtk_attribute("cell_line_width") || 0.1).to_f
104
+ @sum_line_width=(list.gtk_attribute("sum_line_width") || 0.3).to_f
105
105
  @print_title=list.gtk_attribute("print_title")=="true"
106
106
  @row_underline=(list.gtk_attribute("row_underline") || 0.0).to_f
107
107
  @print_with_gantt=(list.gtk_attribute("print_with_gantt") || "false") == "true"
@@ -144,7 +144,7 @@ class PrintItem
144
144
 
145
145
  @columns_header=ColumnsHeaderLayout.new(self,cr,list.columns,@columns_header_font).set_y(@current_height)
146
146
  @layouts.push(@columns_header)
147
- @current_height += @columns_header.height + @header_line_width
147
+ @current_height += @columns_header.height + @header_line_width + @row_spacing
148
148
 
149
149
  @sum_y=@y+height #max y for iters, when less rows than designed, we'll have the footer @ design position
150
150
 
@@ -180,9 +180,10 @@ class PrintItem
180
180
  edebug("breaking list #{list} to the next page","printing","info")
181
181
  break
182
182
  end
183
- il.set_y(@current_height)
184
- @current_height+=il.row_height+@row_spacing
183
+ il.set_y(@current_height).set_row_spacing(@row_spacing)
184
+ @current_height+=il.row_height+2*@row_spacing
185
185
  @layouts.push(il)
186
+ edebug("row :#{il.inspect}","printing")
186
187
  @sums.each_key{|key| @sums[key]=@sums[key]+iter[key].to_f}
187
188
  end
188
189
  end
data/lib/PrintEditor.rb CHANGED
@@ -54,7 +54,11 @@ class WysiwygPrintEditor < Gtk::Window
54
54
  buttons.append("image",nil,nil,Gtk::Image.new(Gtk::Stock::ADD,is)){set_focused_item(nth_page(tabs.page).put(@tabs.page,'image')) if tabs.page>-1}
55
55
  buttons.append(Gtk::VSeparator.new)
56
56
  buttons.append("clone",nil,nil,Gtk::Image.new(Gtk::Stock::COPY,is)){
57
- set_focused_item(nth_page(tabs.page).put(@tabs.page,@focused_item.gtk_type,nil,@focused_item.x+@info.clone_x.value,@focused_item.y+@info.clone_y.value,@focused_item.width,@focused_item.height,@focused_item.text,@focused_item.font,@focused_item.text_alignment)) if tabs.page>-1 && @focused_item
57
+ set_focused_item(nth_page(tabs.page).
58
+ put(@tabs.page,@focused_item.gtk_type,nil,@focused_item.x+@info.clone_x.value,@focused_item.y+@info.clone_y.value,@focused_item.width,@focused_item.height,@focused_item.text,@focused_item.font,@focused_item.text_alignment)) if tabs.page>-1 && @focused_item
59
+ }
60
+ buttons.append("move",nil,nil,Gtk::Image.new(Gtk::Stock::MEDIA_FORWARD,is)){
61
+ @focused_item.move_me(@focused_item.x+@info.clone_x.value,@focused_item.y+@info.clone_y.value) if tabs.page>-1 && @focused_item
58
62
  }
59
63
  buttons.append(Gtk::VSeparator.new)
60
64
  buttons.append("remove",nil,nil,Gtk::Image.new(Gtk::Stock::DELETE,is)){
@@ -107,7 +111,7 @@ class WysiwygPrintEditor < Gtk::Window
107
111
  buttons.append(Gtk::VSeparator.new)
108
112
  signal_connect("destroy"){|me,ev| to_mysql}
109
113
 
110
- @info=LayItemInfo.new.set_width_request(200)
114
+ @info=LayItemInfo.new.set_width_request(220)
111
115
 
112
116
  tab_holder=Gtk::HPaned.new#(false,0)
113
117
  tab_holder.pack1(tabs,true,true)
@@ -28,9 +28,9 @@ class LayItemInfo < Gtk::Table
28
28
  attach(@list_frame=Gtk::Frame.new("list").add(@item_list=ItemList.new),0,3,7,8,Gtk::FILL,Gtk::SHRINK)
29
29
  attach(@align_frame=Gtk::Frame.new("list").add(@item_align=ItemTextAlignment.new),0,3,8,9,Gtk::FILL,Gtk::SHRINK)
30
30
 
31
- attach(Gtk::Label.new("clone"),0,1,9,10,Gtk::FILL,Gtk::SHRINK)
32
- attach(Gtk::Frame.new("left+").add(@clone_x=Gtk::SpinButton.new(0,5000,1)),1,2,9,10,Gtk::FILL,Gtk::SHRINK)
33
- attach(Gtk::Frame.new("top+").add(@clone_y=Gtk::SpinButton.new(0,5000,1)),2,3,9,10,Gtk::FILL,Gtk::SHRINK)
31
+ attach(Gtk::Label.new("clone\r\nor move"),0,1,9,10,Gtk::FILL,Gtk::SHRINK)
32
+ attach(Gtk::Frame.new("left+").add(@clone_x=Gtk::SpinButton.new(-5000,5000,1).set_value(0)),1,2,9,10,Gtk::FILL,Gtk::SHRINK)
33
+ attach(Gtk::Frame.new("top+").add(@clone_y=Gtk::SpinButton.new(-5000,5000,1).set_value(0)),2,3,9,10,Gtk::FILL,Gtk::SHRINK)
34
34
 
35
35
 
36
36
  attach(Gtk::Label.new,0,3,10,11)
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 1
7
- - 1559
7
+ - 1570
8
8
  - 0
9
- version: 1.1559.0
9
+ version: 1.1570.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Dobai-Pataky Balint
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-06-23 00:00:00 +03:00
17
+ date: 2011-08-23 00:00:00 +03:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -36,13 +36,11 @@ dependencies:
36
36
  requirement: &id002 !ruby/object:Gem::Requirement
37
37
  none: false
38
38
  requirements:
39
- - - ~>
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  segments:
42
42
  - 0
43
- - 90
44
- - 7
45
- version: 0.90.7
43
+ version: "0"
46
44
  type: :runtime
47
45
  version_requirements: *id002
48
46
  description: Manqod is a desktop application for small companies to organize their data on an interface customised for them by themselves