openall_time_applet 0.0.26 → 0.0.27
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/VERSION +1 -1
- data/gui/win_main.rb +2 -2
- data/lib/openall_time_applet.rb +27 -32
- data/models/timelog.rb +1 -6
- data/openall_time_applet.gemspec +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.27
|
data/gui/win_main.rb
CHANGED
@@ -147,7 +147,7 @@ class Openall_time_applet::Gui::Win_main
|
|
147
147
|
10 => {:col => :sync_need},
|
148
148
|
11 => {
|
149
149
|
:col => :task_id,
|
150
|
-
:value_callback => lambda{
|
150
|
+
:value_callback => lambda{|data|
|
151
151
|
task = @args[:oata].ob.get_by(:Task, {"title" => data[:value]})
|
152
152
|
|
153
153
|
if !task
|
@@ -156,7 +156,7 @@ class Openall_time_applet::Gui::Win_main
|
|
156
156
|
return task.id
|
157
157
|
end
|
158
158
|
},
|
159
|
-
:value_set_callback => proc{
|
159
|
+
:value_set_callback => proc{|data| data[:model].task_name }
|
160
160
|
}
|
161
161
|
}
|
162
162
|
)
|
data/lib/openall_time_applet.rb
CHANGED
@@ -349,29 +349,8 @@ class Openall_time_applet
|
|
349
349
|
if @timelog_active
|
350
350
|
secs_passed = Time.now.to_i - @timelog_active_time.to_i
|
351
351
|
|
352
|
-
|
353
|
-
|
354
|
-
timelog_use = @ob.get_by(:Timelog, {
|
355
|
-
"parent_timelog" => @timelog_active,
|
356
|
-
"timestamp_day" => Time.now
|
357
|
-
})
|
358
|
-
if !timelog_use
|
359
|
-
timelog_use = @ob.add(:Timelog, {
|
360
|
-
:task_id => @timelog_active[:task_id],
|
361
|
-
:parent_timelog_id => @timelog_active.id,
|
362
|
-
:timestamp => Time.now,
|
363
|
-
:descr => @timelog_active[:descr],
|
364
|
-
:transportdescription => @timelog_active[:transportdescription],
|
365
|
-
:workinternal => @timelog_active[:workinternal],
|
366
|
-
:timetype => @timelog_active[:timetype]
|
367
|
-
})
|
368
|
-
end
|
369
|
-
else
|
370
|
-
timelog_use = @timelog_active
|
371
|
-
end
|
372
|
-
|
373
|
-
timelog_use.update(
|
374
|
-
:time => timelog_use[:time].to_i + secs_passed,
|
352
|
+
@timelog_active.update(
|
353
|
+
:time => @timelog_active[:time].to_i + secs_passed,
|
375
354
|
:sync_need => 1
|
376
355
|
)
|
377
356
|
@timelog_logged_time[:timestamp_end] = Time.now
|
@@ -385,10 +364,27 @@ class Openall_time_applet
|
|
385
364
|
|
386
365
|
#Sets a new timelog to track. Stops tracking of previous timelog if already tracking.
|
387
366
|
def timelog_active=(timelog)
|
367
|
+
timelog_use = @ob.get_by(:Timelog, {
|
368
|
+
"task_id" => timelog[:task_id],
|
369
|
+
"descr" => timelog[:descr],
|
370
|
+
"timestamp_day" => Time.now
|
371
|
+
})
|
372
|
+
if !timelog_use
|
373
|
+
timelog_use = @ob.add(:Timelog, {
|
374
|
+
:task_id => timelog[:task_id],
|
375
|
+
:parent_timelog_id => timelog.id,
|
376
|
+
:timestamp => Time.now,
|
377
|
+
:descr => timelog[:descr],
|
378
|
+
:transportdescription => timelog[:transportdescription],
|
379
|
+
:workinternal => timelog[:workinternal],
|
380
|
+
:timetype => timelog[:timetype]
|
381
|
+
})
|
382
|
+
end
|
383
|
+
|
388
384
|
begin
|
389
385
|
self.timelog_stop_tracking
|
390
|
-
@timelog_logged_time = @ob.add(:Timelog_logged_time,
|
391
|
-
@timelog_active =
|
386
|
+
@timelog_logged_time = @ob.add(:Timelog_logged_time, :timelog_id => timelog_use.id)
|
387
|
+
@timelog_active = timelog_use
|
392
388
|
@timelog_active_time = Time.new
|
393
389
|
|
394
390
|
@events.call(:timelog_active_changed)
|
@@ -433,13 +429,12 @@ class Openall_time_applet
|
|
433
429
|
self.status = sprintf(_("Restarted automatic sync. to run every %s minutes."), Knj::Locales.number_out(interval, 1))
|
434
430
|
|
435
431
|
#Start new timeout.
|
436
|
-
@autosync_timeout = Gtk.timeout_add(interval_msecs)
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
end
|
432
|
+
@autosync_timeout = Gtk.timeout_add(interval_msecs, &self.method(:gtk_timeout))
|
433
|
+
end
|
434
|
+
|
435
|
+
def gtk_timeout
|
436
|
+
@sync_thread = Knj::Thread.new(&self.method(:run_autosync)) if !@sync_thread
|
437
|
+
true
|
443
438
|
end
|
444
439
|
|
445
440
|
#This method is executing the automatic synchronization.
|
data/models/timelog.rb
CHANGED
@@ -97,12 +97,7 @@ class Openall_time_applet::Models::Timelog < Knj::Datarow
|
|
97
97
|
col = :time
|
98
98
|
end
|
99
99
|
|
100
|
-
|
101
|
-
self.ob.list(:Timelog, "parent_timelog" => self) do |tlog|
|
102
|
-
time += tlog[col].to_i
|
103
|
-
end
|
104
|
-
|
105
|
-
return time
|
100
|
+
return self[col].to_i
|
106
101
|
end
|
107
102
|
|
108
103
|
#Returns the time as a human readable format.
|
data/openall_time_applet.gemspec
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: openall_time_applet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.27
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Kasper Johansen
|
@@ -209,7 +209,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
209
209
|
requirements:
|
210
210
|
- - ">="
|
211
211
|
- !ruby/object:Gem::Version
|
212
|
-
hash:
|
212
|
+
hash: 1133532196206197522
|
213
213
|
segments:
|
214
214
|
- 0
|
215
215
|
version: "0"
|