Class: JLDrill::Gtk::StatisticsWindow

Inherits:
Gtk::Window
  • Object
show all
Includes:
Context::Gtk::Widget
Defined in:
lib/jldrill/views/gtk/widgets/StatisticsWindow.rb

Instance Attribute Summary collapse

Attributes included from Context::Gtk::Widget

#gtkWidgetMainWindow

Instance Method Summary collapse

Methods included from Context::Gtk::Widget

#addToThisWidget, #afterWidgetIsAdded, #afterWidgetIsRemoved, #expandWidgetHeight, #expandWidgetHeight?, #expandWidgetWidth, #expandWidgetWidth?, #gtkAddWidget, #gtkRemoveWidget, #isAMainWindow, #isInTests?, #removeFromThisWidget, #setupWidget, #widgetWasAddedTo, #widgetWasRemovedFrom

Constructor Details

#initialize(view) ⇒ StatisticsWindow

Returns a new instance of StatisticsWindow.



137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/jldrill/views/gtk/widgets/StatisticsWindow.rb', line 137

def initialize(view)
    @view = view
    @closed = false
    super("Statistics")
    connectSignals unless @view.nil?

    tabs = Gtk::Notebook.new()
    add(tabs)
    reviewSetLabel = Gtk::Label.new("Review Set")
    @reviewStats = StatisticsPage.new(view)
    tabs.append_page(@reviewStats.widget, reviewSetLabel)
    forgottenSetLabel = Gtk::Label.new("Forgotten Set")
    @forgottenStats = StatisticsPage.new(view)
    tabs.append_page(@forgottenStats.widget, forgottenSetLabel)
end

Instance Attribute Details

#accelObject (readonly)

Returns the value of attribute accel.



135
136
137
# File 'lib/jldrill/views/gtk/widgets/StatisticsWindow.rb', line 135

def accel
  @accel
end

Instance Method Details

#closeObject



171
172
173
174
175
# File 'lib/jldrill/views/gtk/widgets/StatisticsWindow.rb', line 171

def close
    if !@closed
        @view.close
    end
end

#connectSignalsObject



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/jldrill/views/gtk/widgets/StatisticsWindow.rb', line 153

def connectSignals
    @accel = Gtk::AccelGroup.new
    @accel.connect(Gdk::Keyval::GDK_Escape, 0,
                   Gtk::ACCEL_VISIBLE) do
        self.close
    end
    add_accel_group(@accel)
    
    signal_connect('delete_event') do
        # Request that the destroy signal be sent
        false
    end
    
    signal_connect('destroy') do
        self.close
    end
end

#explicitDestroyObject



177
178
179
180
# File 'lib/jldrill/views/gtk/widgets/StatisticsWindow.rb', line 177

def explicitDestroy
    @closed = true
    self.destroy
end

#showBusy(bool) ⇒ Object



206
207
208
209
210
211
212
213
# File 'lib/jldrill/views/gtk/widgets/StatisticsWindow.rb', line 206

def showBusy(bool)
    if bool
        self.window.set_cursor(Gdk::Cursor.new(Gdk::Cursor::WATCH))
    else
        self.window.set_cursor(nil)
    end
    Gdk::flush()
end

#updateForgottenAccuracy(stats) ⇒ Object



198
199
200
# File 'lib/jldrill/views/gtk/widgets/StatisticsWindow.rb', line 198

def updateForgottenAccuracy(stats)
    @forgottenStats.updateAccuracy(stats)
end

#updateForgottenDuration(counter) ⇒ Object



194
195
196
# File 'lib/jldrill/views/gtk/widgets/StatisticsWindow.rb', line 194

def updateForgottenDuration(counter)
    @forgottenStats.updateDuration(counter)
end

#updateForgottenRate(stats) ⇒ Object



202
203
204
# File 'lib/jldrill/views/gtk/widgets/StatisticsWindow.rb', line 202

def updateForgottenRate(stats)
    @forgottenStats.updateRate(stats)
end

#updateReviewAccuracy(stats) ⇒ Object



186
187
188
# File 'lib/jldrill/views/gtk/widgets/StatisticsWindow.rb', line 186

def updateReviewAccuracy(stats)
    @reviewStats.updateAccuracy(stats)
end

#updateReviewDuration(counter) ⇒ Object



182
183
184
# File 'lib/jldrill/views/gtk/widgets/StatisticsWindow.rb', line 182

def updateReviewDuration(counter)
    @reviewStats.updateDuration(counter)
end

#updateReviewRate(stats) ⇒ Object



190
191
192
# File 'lib/jldrill/views/gtk/widgets/StatisticsWindow.rb', line 190

def updateReviewRate(stats)
    @reviewStats.updateRate(stats)
end