~ubuntu-branches/ubuntu/saucy/amsn/saucy

« back to all changes in this revision

Viewing changes to plugins/chameleon/label.tcl

  • Committer: Bazaar Package Importer
  • Author(s): Devid Antonio Filoni
  • Date: 2010-04-13 23:21:29 UTC
  • mfrom: (1.1.11 upstream) (3.1.8 sid)
  • Revision ID: james.westby@ubuntu.com-20100413232129-vgpx20brdd2qavs7
Tags: 0.98.3-0ubuntu1
* Merge from Debian unstable (LP: #449072), remaining Ubuntu changes:
  - add 08_use_aplay_for_sound.dpatch patch by Festor Wailon Dacoba to use
    aplay to play sounds
  + debian/control:
    - modify iceweasel to firefox | abrowser in amsn Suggests field
    - add xdg-utils and gstreamer0.10-nice to amsn Depends field
    - mofify sox to alsa-utils in amsn Suggests field as we are now using
      aplay
* New upstream release (LP: #562619), tarball repacked according to
  debian/README.source.
* Fix missing-debian-source-format lintian warning.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
namespace eval ::chameleon::label {
 
2
  proc label_customParseConfArgs {w parsed_options args } {
 
3
    array set options           $args
 
4
    array set ttk_options       $parsed_options
 
5
    
 
6
    if { [info exists options(-padx)] && [string is digit -strict $options(-padx)]  } {
 
7
      set padx $options(-padx)
 
8
    } else {
 
9
      set padx 0
 
10
    }
 
11
 
 
12
    if { [info exists options(-pady)] && [string is digit -strict $options(-pady)] } {
 
13
      set pady $options(-pady)
 
14
    } else {
 
15
      set pady 0
 
16
    }
 
17
 
 
18
    if {$padx == 0 && $pady == 0 && [info exists options(-bd)] } {
 
19
      set ttk_options(-padding) $options(-bd)
 
20
    } else {
 
21
      if {$padx == 0 && $pady != 0 } {
 
22
        set ttk_options(-padding) [list 2 $pady]
 
23
      } elseif {$padx != 0 && $pady == 0 } {
 
24
        set ttk_options(-padding) [list $padx 2]
 
25
      } elseif {$padx != 0 && $pady != 0 } {
 
26
        set ttk_options(-padding) [list $padx $pady]
 
27
      }
 
28
    }
 
29
    
 
30
    if { [info exists options(-width)] } {
 
31
      if {$options(-width) == 0} {
 
32
        set ttk_options(-width) [list]
 
33
      } else {
 
34
        set ttk_options(-width) $options(-width)
 
35
      }
 
36
    }
 
37
 
 
38
    if { [info exists options(-image)] } { 
 
39
      array unset ttk_options -width
 
40
    }
 
41
    
 
42
    return [array get ttk_options]
 
43
  }
 
44
 
 
45
  proc init_labelCustomOptions { } {
 
46
    variable label_widgetOptions
 
47
    
 
48
    array set label_widgetOptions {
 
49
      -activebackground         -ignore
 
50
      -activeforeground         -ignore
 
51
      -anchor                   -anchor
 
52
      -background               -background
 
53
      -bd                       -styleOption
 
54
      -bg                       -background
 
55
      -bitmap                   -ignore
 
56
      -border                   -styleOption
 
57
      -borderwidth              -styleOption
 
58
      -class                    -class
 
59
      -compound                 -compound
 
60
      -cursor                   -cursor
 
61
      -disabledforeground       -ignore
 
62
      -fg                       -foreground
 
63
      -font                     -font
 
64
      -foreground               -foreground
 
65
      -height                   -ignore
 
66
      -highlightbackground      -ignore
 
67
      -highlightcolor           -ignore
 
68
      -highlightthickness       -ignore
 
69
      -image                    -image
 
70
      -justify                  -justify
 
71
      -padx                     -toImplement
 
72
      -pady                     -toImplement
 
73
      -relief                   -relief
 
74
      -state                    -state
 
75
      -takefocus                -takefocus
 
76
      -text                     -text
 
77
      -textvariable             -textvariable
 
78
      -underline                -underline
 
79
      -width                    -toImplement
 
80
      -wraplength               -wraplength
 
81
    }    
 
82
  }
 
83
 
 
84
  proc label_customCget { w option } {
 
85
    set padding [$w cget -padding]
 
86
 
 
87
    if { [llength $padding] > 0 } {
 
88
      foreach {padx pady} $padding {break}
 
89
    }
 
90
 
 
91
    if { $option eq "-padx" && [info exists padx] } {
 
92
      return $padx
 
93
    }
 
94
    if { $option eq "-pady" && [info exists pady] } {
 
95
      return $pady
 
96
    }
 
97
 
 
98
    if {$option eq "-width"} {
 
99
      set width [$w cget -width]
 
100
 
 
101
      if {![string is digit -strict $width]} {
 
102
        return 0
 
103
      } else {
 
104
        return $width
 
105
      }
 
106
    }
 
107
 
 
108
    return ""
 
109
  }
 
110
}