Class: Ruber::Rake::ChooseTaskDlg
- Inherits:
-
KDE::Dialog
- Object
- KDE::Dialog
- Ruber::Rake::ChooseTaskDlg
- Defined in:
- plugins/rake/rake_widgets.rb
Overview
Where the user can choose the rake task to execute
Instance Method Summary (collapse)
-
- (nil) fill_tasks_widget
slot
private
Inserts the tasks for the object passed to the constructor in the task widget.
-
- (ChooseTaskDlg) initialize(prj, parent = Ruber[:main_window])
constructor
A new instance of ChooseTaskDlg.
-
- (String?) task
The selected task.
-
- (nil) update_tasks
slot
private
Updates the list of tasks.
Constructor Details
- (ChooseTaskDlg) initialize(prj, parent = Ruber[:main_window])
A new instance of ChooseTaskDlg
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'plugins/rake/rake_widgets.rb', line 48 def initialize prj, parent = Ruber[:main_window] super parent @ui = Ui::RakeChooseTaskWidget.new @ui.setupUi @project = prj @ui.tasks.model = Qt::SortFilterProxyModel.new @ui.tasks @tasks_model = Qt::StandardItemModel.new self @ui.tasks.model.source_model = @tasks_model @tasks_model.horizontal_header_labels = %w[Task Description] false @ui.tasks.selection_model.connect(SIGNAL('selectionChanged(QItemSelection, QItemSelection)')) do @ui.tasks.selection_model.has_selection end connect @ui.refresh_tasks, SIGNAL(:clicked), self, SLOT(:update_tasks) @ui.search_line.proxy = @ui.tasks.model @ui.tasks.set_focus end |
Instance Method Details
- (nil) fill_tasks_widget (private)
Inserts the tasks for the object passed to the constructor in the task widget.
Note:
this method uses the ProjectExtension#update_tasks method,
so it can take some seconds to complete.
86 87 88 89 90 91 92 93 94 |
# File 'plugins/rake/rake_widgets.rb', line 86 def tasks = @project[:rake, :tasks] items = tasks.sort.map{|task, data| [Qt::StandardItem.new(task), Qt::StandardItem.new(data[0])]} @tasks_model.remove_rows 0, @ui.tasks.model.row_count items.each{|i| @tasks_model.append_row i} @ui.tasks.resize_column_to_contents 0 @ui.tasks.enabled = true nil end |
Slot Signature:
fill_tasks_widget()
- (String?) task
The selected task
72 73 74 75 |
# File 'plugins/rake/rake_widgets.rb', line 72 def task sel = @ui.tasks.selection_model.selected_rows[0] sel ? sel.data.to_string : nil end |
- (nil) update_tasks (private)
Updates the list of tasks
102 103 104 105 106 107 |
# File 'plugins/rake/rake_widgets.rb', line 102 def update_tasks Ruber::Application.with_override_cursor do @project.extension(:rake).update_tasks end end |
Slot Signature:
update_tasks()