]> git.neil.brown.name Git - scribble.git/commitdiff
Add Makefile and some sample pages.
authorNeil Brown <neilb@notabene.brown>
Sun, 24 Aug 2008 09:37:25 +0000 (19:37 +1000)
committerNeil Brown <neilb@notabene.brown>
Sun, 24 Aug 2008 09:37:25 +0000 (19:37 +1000)
Preparing for a possible very early release.

Makefile [new file with mode: 0644]
Sample-Pages/1 [new file with mode: 0755]
Sample-Pages/2 [new file with mode: 0755]
Sample-Pages/3 [new file with mode: 0755]
scribble.py

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..6633266
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,9 @@
+
+install:
+       cp scribble.py /usr/bin
+       chmod a+rx /usr/bin/scribble.py
+       cp scribble.desktop /usr/share/applications
+       chmod a+r /usr/share/applications/scribble.desktop
+       cp scribble.png /usr/share/pixmaps/scribble.png
+       chmod a+r /usr/share/pixmaps/scribble.png
+       if [ -d $$HOME/Pages ] ; then : ; else cp -r Sample-Pages $$HOME/Pages; fi
diff --git a/Sample-Pages/1 b/Sample-Pages/1
new file mode 100755 (executable)
index 0000000..aea83a1
--- /dev/null
@@ -0,0 +1,19 @@
+"black":64,81:"Welcome to"
+"black":72,159:62,162:45,170:34,178:36,192:48,201:63,207:79,214:92,226:97,245:95,263:83,278:65,287:51,289:50,278
+"black":146,200:136,204:122,212:120,241:131,246:144,249:159,243:169,235
+"black":177,206:188,221:193,231:186,211:186,199:199,187:209,183:219,182:234,181:238,191
+"black":255,186:261,196:270,213
+"black":263,111:270,142:276,170:280,186:284,199:286,209:292,224:292,213:293,203:294,192:299,178:317,187:317,201:307,210:292,202
+"black":321,103:321,119:327,156:330,176:332,193:333,207:337,194:345,175:357,171:365,182:360,197:333,194
+"black":371,96:371,108:374,124:376,138:380,154:382,171:387,195
+"black":416,182:421,171:433,161:429,151:417,155:407,168:405,183:410,193:422,196:454,183
+"red":433,211:423,212:405,214:393,215:380,218:367,221:355,225:344,230:332,233:319,237:307,241:295,245:283,250:258,258:235,264:224,267:214,270:201,273:189,276:177,279:153,285:142,289:129,293:117,296:106,300:96,303:79,310:63,316
+"black":92,384:91,396:92,417:91,429:89,417:88,400:90,385:94,371:102,360:113,357:123,359:131,371:129,383:123,394:112,402:100,403
+"black":133,403:139,414:137,401:148,390:162,390:173,395
+"black":174,411:189,407:200,404:208,394:198,388:186,391:178,403:182,418:195,426:208,426:221,422
+"black":253,398:240,394:227,396:232,406:243,410:225,421
+"black":288,405:264,404:275,413:286,418:276,428:259,431:249,431
+"red":359,349:370,359:381,370:391,377:404,391:399,401:389,407:379,411:366,418:356,425:346,431
+"red":94,506:"to continue"
+"red":65,48:71,36:70,23:69,12:59,23
+"red":68,7:76,17:85,29
diff --git a/Sample-Pages/2 b/Sample-Pages/2
new file mode 100755 (executable)
index 0000000..bc60b71
--- /dev/null
@@ -0,0 +1,23 @@
+"black":31,42:"Here is a page number"
+"black":350,36:361,38:372,40:383,36:395,35:405,33:416,29:426,25:441,18:450,7:440,8:451,7:454,17:453,27
+"black":33,103:"Use"
+"black":202,82:192,80:180,90:168,101:158,106:171,118:189,129:199,135
+"black":241,113:"To go back"
+"black":92,161:106,168:116,174:128,183:140,193:134,204:124,214:113,225:103,234:93,242
+"black":176,198:"for next"
+"black":58,259:54,274:58,291:65,303:79,308:91,303:101,264:101,254
+"black":112,276:117,289:120,300:124,289:138,284:149,295
+"black":192,283:182,282:172,285:170,296:180,298:190,290:192,279:191,265:186,246:183,234:186,251:189,262:190,273:192,284:194,294:197,304
+"black":217,291:226,280:236,278:247,287:245,299:226,305:213,294:215,284:225,280:241,280
+"black":58,349:67,359:71,371:70,360:71,350:77,338:90,335:102,337:112,342
+"black":123,352:134,355:146,355:156,354:163,343:151,338:135,340:129,356:141,371:167,375:184,372
+"black":224,336:222,346:208,350:201,364:208,376:218,372:225,357:225,337:222,321:224,342:227,353:230,363:235,373
+"black":261,361:262,349:274,343:285,348:288,359:272,374:258,369:258,359:264,349
+"black":65,406:68,395:69,409:71,425:73,436
+"black":86,412:76,414:58,416:46,416
+"black":110,436:"add page"
+"black":96,499:84,499:73,500:63,500:53,502
+"black":121,510:"remove page"
+"black":365,503:375,500:378,510:368,514:360,504:371,503
+"black":402,510:402,500:408,510:397,515:390,504:407,499
+"black":429,507:440,504:444,516:430,515:422,503:435,502
diff --git a/Sample-Pages/3 b/Sample-Pages/3
new file mode 100755 (executable)
index 0000000..e3ddef8
--- /dev/null
@@ -0,0 +1,18 @@
+"black":117,45:122,57:108,51:96,48:82,53:70,62:57,74:47,86:41,100:40,117:41,128:48,146:56,156:66,165:78,171:110,177:133,169
+"black":158,119:"Clear page"
+"black":195,159:"Before removal"
+"black":83,235:84,224:80,250:79,270:78,289:78,319:79,330
+"black":165,229:149,223:128,220:105,218:60,213:46,213:36,213
+"black":120,308:130,303:143,298:156,306:154,320:139,329:129,326:127,308
+"black":186,297:175,305:168,315:178,318:189,315:199,304:201,321:203,332:169,367:162,357:165,344
+"black":241,304:229,298:219,306:216,319:230,325:241,320:251,310:251,299:252,310:257,340:256,362:250,376:236,379:224,372:221,361
+"black":271,227:271,240:274,255:275,271:277,291:278,308:279,318
+"black":299,322:309,320:328,305:318,300:303,313:333,335:361,322
+"black":219,392:222,409:224,426:226,437
+"black":273,405:261,398:217,395:204,394:193,393:179,394
+"black":249,426:261,424:271,424:268,413:252,418:247,431:263,439:285,441:297,441
+"black":295,424:311,427:322,434
+"black":324,420:312,441:302,455
+"black":354,373:349,388:350,400:351,414:353,427:354,444
+"black":380,414:366,405:355,401:343,400:332,398:322,397
+"black":66,492:"Tap to enable"
index 41c5fd70edce0d34981043456969ed01a6a4bd83..1f476908685b7f3c5525d00d5b90ddda479e3da5 100755 (executable)
@@ -15,7 +15,7 @@ def LoadDict(dict):
     # Where they are like lowercase, we either double
     # the last stroke (L, J, I) or draw backwards (S, Z, X)
     # U V are a special case
-    
+
     dict.add('A', "R(4)6,8")
     dict.add('B', "R(4)6,4.R(7)1,6")
     dict.add('B', "R(4)6,4.L(4)2,8.R(7)1,6")
@@ -26,7 +26,7 @@ def LoadDict(dict):
     # double the stem for F
     dict.add('F', "L(4)2,6.S(3)7,1")
     dict.add('F', "S(1)5,3.S(3)1,7.S(3)7,1")
-    
+
     dict.add('G', "L(4)2,5.S(8)1,7")
     dict.add('G', "L(4)2,5.R(8)6,8")
     # FIXME I need better straight-curve alignment
@@ -215,8 +215,8 @@ class DictPattern:
                 return m
             cnt += m
         return cnt
-    
-            
+
+
 class Dictionary:
     # The dictionary hold all the pattern for symbols and
     # performs lookup
@@ -228,7 +228,7 @@ class Dictionary:
     # location on the touchscreen.
     # A match requires a unique entry with a match that is better
     # than any other entry.
-    # 
+    #
     def __init__(self):
         self.dict = []
     def add(self, sym, pat, top = None, bot = None):
@@ -247,7 +247,7 @@ class Dictionary:
             elif cnt == max:
                 val = None
         return val
-    
+
     def match(self, str, pos = "mid"):
         p = DictPattern(str)
         m = self._match(p)
@@ -297,7 +297,7 @@ class Point:
         x = self.x - p.x
         y = self.y - p.y
         return x*x + y*y
-    
+
     def xdir(self,p):
         if self.x > p.x:
             return 1
@@ -342,7 +342,7 @@ class Point:
         x = (self.xsum - p.xsum) / (self.cnt - p.cnt)
         y = (self.ysum - p.ysum) / (self.cnt - p.cnt)
         return (x,y)
-    
+
     def is_sharp(self,A,C):
         # Measure the cosine at self between A and C
         # as A and C could be curve, we take the mean point on
@@ -364,7 +364,7 @@ class BBox:
     # a BBox records min/max x/y of some Points and
     # can subsequently report row, column, pos of each point
     # can also locate one bbox in another
-    
+
     def __init__(self, p):
         self.minx = p.x
         self.maxx = p.x
@@ -441,7 +441,7 @@ class BBox:
         else:
             y = 1
         return y*3 + x
-    
+
 
 def different(*args):
     cur = 0
@@ -712,7 +712,13 @@ class ScribblePad:
         self.colourname = "black"
         self.bg = page.get_style().bg_gc[gtk.STATE_NORMAL]
 
-       self.page_dir = os.environ['HOME'] + '/Pages'
+        if 'HOME' in os.environ:
+            home = os.environ['HOME']
+        else:
+            home = ""
+        if home == "" or home == "/":
+            home = "/home/root"
+        self.page_dir = home + '/Pages'
         self.load_pages()
 
         window.set_default_size(480,640)
@@ -740,10 +746,10 @@ class ScribblePad:
         self.pagenum = 0
         self.load_page()
         return
-    
+
     def press(self, c, ev):
         # Start a new line
-        
+
         self.line = [ self.colourname, [int(ev.x), int(ev.y)] ]
         return
     def release(self, c, ev):
@@ -766,7 +772,7 @@ class ScribblePad:
                 self.redraw()
             self.line = None
             return
-        
+
         self.lines.append(self.line)
         self.texttoggle.set_sensitive(False)
         self.line = None
@@ -829,14 +835,14 @@ class ScribblePad:
                            self.textstr[self.textcurs:]
             self.textcurs += 1
         self.redraw()
-        
-        
+
+
     def getsym(self):
         alloc = self.page.get_allocation()
         pagebb = BBox(Point(0,0))
         pagebb.add(Point(alloc.width, alloc.height))
         pagebb.finish()
-        
+
         p = PPath(self.line[1][0], self.line[1][1])
         for pp in self.line[1:]:
             p.add(pp[0], pp[1])
@@ -894,7 +900,7 @@ class ScribblePad:
         self.pagenum += 1
         self.load_page()
         self.redraw()
-        
+
         return
     def colour_change(self,t):
         if t.get_active():
@@ -957,7 +963,7 @@ class ScribblePad:
             self.pagenum -= 1
         self.load_page()
         self.redraw()
-            
+
         return
     def clear(self,b):
         while len(self.lines) > 0:
@@ -979,7 +985,7 @@ class ScribblePad:
                 w = [x,y]
             line.append(w)
         return line
-    
+
     def load_page(self):
         nm = self.names[self.pagenum]
         if nm in self.pages:
@@ -1024,11 +1030,10 @@ class ScribblePad:
                     f.write("%d,%d" %( w[0],w[1]))
             f.write("\n")
         f.close()
-        
+
 def main():
     gtk.main()
     return 0
 if __name__ == "__main__":
     ScribblePad()
     main()
-