/[gzz]/gzz/gfx/demo/calendarvobtest.py
ViewVC logotype

Diff of /gzz/gfx/demo/calendarvobtest.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by mudyc, Wed Oct 30 14:09:32 2002 UTC revision 1.4 by mudyc, Wed Oct 30 15:07:03 2002 UTC
# Line 7  style_n = GraphicsAPI.getInstance().getT Line 7  style_n = GraphicsAPI.getInstance().getT
7    
8  class ViewScene:  class ViewScene:
9      def __init__(self):      def __init__(self):
10          self.scale = 1;          self.scale = 0.10;
11          self.ty = 1;          self.ty = -3000;
12          self.tx = 1;          self.tx = 50;
13    
14      def scene(self, vs):      def scene(self, vs):
15          size = vs.getSize()          size = vs.getSize()
# Line 18  class ViewScene: Line 18  class ViewScene:
18          self.bgcolor = (0.6, 0.7, 0.8)          self.bgcolor = (0.6, 0.7, 0.8)
19          putnoc(vs, background(self.bgcolor))          putnoc(vs, background(self.bgcolor))
20    
21          #for i in range(1, 12):          cs_home = vs.coords.affineCoordsys(0,0,
22          #    cs_cal = vs.coords.affineCoordsys(0, 0, w/2 - ((w/3 + self.tx)  * (self.scale -1) ) ,                                          w/2 + self.tx*self.scale,
23          #                                      ((h/6) *i) - ((h/3.5 + self.ty) *(self.scale-1)),                                          h/2 + self.ty*self.scale,
24          #                                      w/7*0.2* self.scale, 0, 0, ((h/12)/5) * self.scale)                                          w*self.scale, 0,0, h*self.scale);
25              #print 'w: ', w,' h: ', h          vs.matcher.add(cs_home, "cs_koti")
   
         #    vs.matcher.add(cs_cal, "cs_cal")  
         #    gzz.vob.CalendarVob.setStatics(style_date, style_n, 5)  
         #    gzz.vob.CalendarVob.setBounds(0.7, 0.5, 1.0)  
         #    vs.map.put(gzz.vob.CalendarVob(2002, i), cs_cal)  
   
         cs_cal = vs.coords.affineCoordsys(0, 0, w/2 - ((w/3 + self.tx)  * (self.scale -1) ) ,  
                                           h/2 - ((h/3.5 + self.ty) *(self.scale-1)),  
                                           w/6 * self.scale, 0, 0, h/5 * self.scale)  
         print 'w: ', w,' h: ', h  
               
         vs.matcher.add(cs_cal, "cs_cal")  
26    
27          # these don't efect          # these don't efect
28          gzz.vob.CalendarVob.setStatics(style_date, style_n, 5)          gzz.vob.CalendarVob.setStatics(style_date, style_n, 3)
29    
30          # week number width, weekday height, month name height          # week number width, weekday height, month name height
31          gzz.vob.CalendarVob.setBounds(0.9, 1.1, 0.8)          gzz.vob.CalendarVob.setBounds(0.9, 1.1, 0.8)
32          vs.map.put(gzz.vob.CalendarVob(2002, 12), cs_cal)  
33            # annual calendar
34            for i in range(1, 13):
35                cs_cal = vs.coords.affineCoordsys(cs_home , 0, 0 , i*10,  1,0,0,1)
36                vs.matcher.add(cs_cal, "cs_cal"+str(i))
37                vs.map.put(gzz.vob.CalendarVob(2002, i), cs_cal)
38    
39    
40            # one test vob
41            #cs_cal = vs.coords.affineCoordsys(0, 0, w/2 - ((w/3 + self.tx)  * (self.scale -1) ) ,
42            #                                  h/2 - ((h/3.5 + self.ty) *(self.scale-1)),
43            #                                  w/6 * self.scale, 0, 0, h/5 * self.scale)
44            #vs.matcher.add(cs_cal, "cs_cal")
45            #gzz.vob.CalendarVob.setBounds(0.9, 1.1, 0.8)
46            #vs.map.put(gzz.vob.CalendarVob(2002, 12), cs_cal)
47    
48    
49    
50          # help text          # help text
# Line 49  class ViewScene: Line 52  class ViewScene:
52          tscale = min(size.width*1.0, size.height*4.0/3) / colchars          tscale = min(size.width*1.0, size.height*4.0/3) / colchars
53          cs1 = vs.coords.affineCoordsys(0, 10, 0, 0, tscale, 0, 0, tscale)          cs1 = vs.coords.affineCoordsys(0, 10, 0, 0, tscale, 0, 0, tscale)
54          vs.matcher.add(cs1, "1")          vs.matcher.add(cs1, "1")
55          putText(vs, cs1, 'Use keys: +, -, Left, Right, Up and Down', color=(0,0,0), h=4, y = 2)          putText(vs, cs1, '  Use keys: +, -, Left, Right, Up, Down,', color=(0,0,0), h=4, y = 3)
56            putText(vs, cs1, '       PageUp, and PageDown', color=(0,0,0), h=4, y = 6)
57    
58                    
59      def key(self, k):      def key(self, k):
# Line 57  class ViewScene: Line 61  class ViewScene:
61              self.scale *= 1.5              self.scale *= 1.5
62          if k == "-":          if k == "-":
63              self.scale *= 0.5              self.scale *= 0.5
64          if k == "Up": self.ty -= 50 / self.scale          if k == "Up": self.ty += 50 / self.scale
65          if k == "Down": self.ty += 50 / self.scale          if k == "Down": self.ty -= 50 / self.scale
66          if k == "Left": self.tx -= 50 / self.scale          if k == "Left": self.tx += 50 / self.scale
67          if k == "Right": self.tx += 50 / self.scale          if k == "Next": self.ty -= 500 / self.scale
68            if k == "Prior": self.ty += 500 / self.scale
69    
70    
71    

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26