~ubuntu-branches/ubuntu/quantal/ruby1.9.1/quantal

« back to all changes in this revision

Viewing changes to ext/tk/sample/tkextlib/ICONS/viewIcons.rb

  • Committer: Bazaar Package Importer
  • Author(s): Lucas Nussbaum
  • Date: 2010-07-31 17:08:39 UTC
  • mfrom: (1.1.4 upstream) (8.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20100731170839-j034dmpdqt1cc4p6
Tags: 1.9.2~svn28788-1
* New release based on upstream snapshot from the 1.9.2 branch,
  after 1.9.2 RC2. That branch is (supposed to be) binary-compatible
  with the 1.9.1 branch.
  + Builds fine on i386. Closes: #580852.
* Upgrade to Standards-Version: 3.9.1. No changes needed.
* Updated generated incs.
* Patches that still need work:
  + Unclear status, need more investigation:
   090729_fix_Makefile_deps.dpatch
   090803_exclude_rdoc.dpatch
   203_adjust_base_of_search_path.dpatch
   902_define_YAML_in_yaml_stringio.rb.dpatch
   919_common.mk_tweaks.dpatch
   931_libruby_suffix.dpatch
   940_test_thread_mutex_sync_shorter.dpatch
  + Maybe not needed anymore, keeping but not applying.
   102_skip_test_copy_stream.dpatch (test doesn't block anymore?)
   104_skip_btest_io.dpatch (test doesn't block anymore?)
   201_gem_prelude.dpatch (we don't use that rubygems anyway?)
   202_gem_default_dir.dpatch (we don't use that rubygems anyway?)
   940_test_file_exhaustive_fails_as_root.dpatch
   940_test_priority_fails.dpatch
   100518_load_libc_libm.dpatch
* Add disable-tests.diff: disable some tests that cause failures on FreeBSD.
  Closes: #590002, #543805, #542927.
* However, many new failures on FreeBSD. Since that version is still an
  improvement, add the check that makes test suite failures non-fatal on
  FreeBSD again. That still needs to be investigated.
* Re-add 903_skip_base_ruby_check.dpatch
* Add build-dependency on ruby1.8 and drop all pre-generated files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
#
5
5
#     --  Display icons from icon library.
6
6
#
7
 
#     --  Copy the clicked icon data (command string of creating 
 
7
#     --  Copy the clicked icon data (command string of creating
8
8
#         a TkPhotoImage instance) to the clipboard.
9
9
#
10
10
require 'tk'
27
27
    ent_library = TkEntry.new(base, :width=>50, :textvariable=>@library)
28
28
    ent_groups  = TkEntry.new(base, :width=>50, :textvariable=>@groups)
29
29
 
30
 
    btn_browse = TkButton.new(base, :text=>'Browse', 
 
30
    btn_browse = TkButton.new(base, :text=>'Browse',
31
31
                                    :command=>method(:select_icons))
32
32
    btn_view   = TkButton.new(base, :text=>'View',
33
33
                                    :command=>method(:display_icons))
35
35
 
36
36
    @column_btns = {}
37
37
    6.step(20, 2){|i|
38
 
      @column_btns[i] = TkButton.new(columns, 
39
 
                                     :text=>i.to_s, :width=>2, 
 
38
      @column_btns[i] = TkButton.new(columns,
 
39
                                     :text=>i.to_s, :width=>2,
40
40
                                     :command=>proc{set_columns(i)}
41
41
                                     ).pack(:side=>:left)
42
42
    }
90
90
  end
91
91
 
92
92
  def _create_info_window
93
 
    @info_window = TkToplevel.new(:background=>'lightyellow', :borderwidth=>1, 
 
93
    @info_window = TkToplevel.new(:background=>'lightyellow', :borderwidth=>1,
94
94
                                  :relief=>:solid){|w|
95
 
      lbl_name = TkLabel.new(w, :text=>'Name', :background=>'lightyellow', 
96
 
                             :font=>@boldfont, :justify=>:left)
97
 
      lbl_grps = TkLabel.new(w, :text=>'Groups', :background=>'lightyellow', 
98
 
                             :font=>@boldfont, :justify=>:left)
99
 
      lbl_type = TkLabel.new(w, :text=>'Type', :background=>'lightyellow', 
100
 
                             :font=>@boldfont, :justify=>:left)
101
 
      lbl_size = TkLabel.new(w, :text=>'Size', :background=>'lightyellow', 
 
95
      lbl_name = TkLabel.new(w, :text=>'Name', :background=>'lightyellow',
 
96
                             :font=>@boldfont, :justify=>:left)
 
97
      lbl_grps = TkLabel.new(w, :text=>'Groups', :background=>'lightyellow',
 
98
                             :font=>@boldfont, :justify=>:left)
 
99
      lbl_type = TkLabel.new(w, :text=>'Type', :background=>'lightyellow',
 
100
                             :font=>@boldfont, :justify=>:left)
 
101
      lbl_size = TkLabel.new(w, :text=>'Size', :background=>'lightyellow',
102
102
                             :font=>@boldfont, :justify=>:left)
103
103
 
104
104
      lbl_name.grid(:row=>0, :column=>0, :sticky=>:w)
192
192
 
193
193
  def cancel_info
194
194
    if @delay_timer
195
 
      @delay_timer.cancel 
 
195
      @delay_timer.cancel
196
196
      @delay_timer = nil
197
197
    end
198
198
    @info_window.withdraw
242
242
    TkClipboard.append(@command)
243
243
 
244
244
    if Tk::PLATFORM['platform'] == 'unix'
245
 
      TkSelection.handle(Tk.root, method(:primary_transfer), 
 
245
      TkSelection.handle(Tk.root, method(:primary_transfer),
246
246
                         :selection=>'PRIMARY')
247
 
      TkSelection.set_owner(Tk.root, :selection=>'PRIMARY', 
 
247
      TkSelection.set_owner(Tk.root, :selection=>'PRIMARY',
248
248
                            :command=>method(:lost_selection))
249
249
    end
250
250
 
256
256
    bbox = @icons_window.bbox('all')
257
257
    width = @controls.winfo_width - @icons_window.yscrollbar.winfo_width - 8
258
258
 
259
 
    @icons_window.configure(:width=>width, :scrollregion=>bbox, 
260
 
                            :xscrollincrement=>'0.1i', 
 
259
    @icons_window.configure(:width=>width, :scrollregion=>bbox,
 
260
                            :xscrollincrement=>'0.1i',
261
261
                            :yscrollincrement=>'0.1i')
262
262
  end
263
263
 
264
264
  def select_icons
265
 
    new_lib = Tk.getOpenFile(:initialdir=>@initial_dir, 
266
 
                             :initialfile=>'tkIcons', 
267
 
                             :title=>'Select Icon Library', 
 
265
    new_lib = Tk.getOpenFile(:initialdir=>@initial_dir,
 
266
                             :initialfile=>'tkIcons',
 
267
                             :title=>'Select Icon Library',
268
268
                             :filetypes=>[
269
 
                               ['Icon Libraries', ['tkIcons*']], 
 
269
                               ['Icon Libraries', ['tkIcons*']],
270
270
                               ['All Files', ['*']]
271
271
                             ])
272
272
 
280
280
    row = 0
281
281
 
282
282
    unless File.exist?(@library.value)
283
 
      Tk.messageBox(:icon=>'warning', :message=>'File does not exist', 
 
283
      Tk.messageBox(:icon=>'warning', :message=>'File does not exist',
284
284
                    :title=>'viewIcons')
285
285
      return
286
286
    end