1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
| # *****************************************************************************
# *
# * This program is free software: you can redistribute it and/or modify
# * it under the terms of the GNU General Public License as published by
# * the Free Software Foundation, either version 3 of the License, or
# * (at your option) any later version.
# *
# * This program is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# * GNU General Public License for more details.
# *
# * You should have received a copy of the GNU General Public License
# * along with this program. If not, see <http://www.gnu.org/licenses/>.
# *
# ****************************************************************************
import pygtk
pygtk.require('2.0')
import gtk
import cairo
import gobject
import gtk.glade
class fenetre:
def __init__(self):
global vor
vor = [ ["LFOC",522,73], ["LACAN",497,150], ["ANG",150,203], ["TUR",425,198], ["AMB",474,228], ["LFEF",458,270], ["NEV",788,286], ["LFOD",276,276], ["LFLX",600,352], ["NTS",23,298], ["ABSIS",253,427], ["PI",356,422], ["POI",346,440], ["BALON",475,458], ["RESON",736,492], ["CGC",242,666], ["LMG",474,627], ["LFOT",417,230] ]
self.height = 700
self.width = 823
self.xml = gtk.glade.XML("acc1.glade")
self.window1 = self.xml.get_widget("window1")
self.darea = self.xml.get_widget("surf")
self.darea.set_size_request(self.width, self.height)
self.darea.realize()
self.context = self.darea.window.cairo_create()
self.context.rectangle(0, 0, self.width, self.height)
self.context.clip()
# w, h = self.darea.window.get_size()
# self.fond = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, False, 8, w, h)
# pixbuf.get_from_drawable(self.darea.window,
# self.darea.window.get_colormap(),
# 0, 0, 0, 0, w, h)
self.window1.connect('destroy',gtk.main_quit)
self.x = vor[4][1]
self.y = vor[4][2]
gobject.timeout_add(1000, self.make_pt)
self.window1.show_all()
self.darea.queue_draw()
def make_pt(self):
self.make_fond()
self.context.set_source_rgb(1.0, 0.0, 0.0)
self.context.rectangle(self.x-1,self.y-1,3,3)
self.context.fill()
self.y+=1
return True
def make_fond(self):
self.context = self.darea.window.cairo_create()
self.context.set_line_width(0.5)
self.context.set_line_cap(cairo.LINE_CAP_ROUND)
self.context.set_line_join(cairo.LINE_JOIN_ROUND)
self.context.set_source_rgb(0.0, 0.0, 0.0)
self.context.rectangle(0, 0, self.width, self.height)
self.context.fill()
self.context.set_source_rgb(1.0, 1.0, 1.0)
for pt in vor:
self.context.rectangle(pt[1]-1, pt[2]-1, 3, 3)
self.context.fill()
self.context.move_to(822,504)
self.context.line_to(vor[12][1],vor[12][2])
self.context.line_to(226,699)
self.context.move_to(vor[12][1],vor[12][2])
self.context.line_to(vor[4][1],vor[4][2])
self.context.move_to(vor[12][1],vor[12][2])
self.context.line_to(vor[10][1],vor[10][2])
self.context.line_to(vor[9][1],vor[9][2])
self.context.move_to(0,316)
self.context.line_to(421,0)
self.context.move_to(475,700)
self.context.line_to(vor[4][1],vor[4][2])
self.context.line_to(vor[0][1],vor[0][2])
self.context.move_to(479,0)
self.context.line_to(vor[0][1],vor[0][2])
self.context.line_to(vor[6][1],vor[6][2])
self.context.line_to(823,322)
self.context.move_to(vor[6][1],vor[6][2])
self.context.line_to(823,296)
self.context.move_to(vor[16][1],vor[16][2])
self.context.line_to(823,447)
#Limite de secteur
self.context.move_to(254,152)
self.context.line_to(254,540)
self.context.line_to(524,540)
self.context.line_to(744,378)
self.context.line_to(644,200)
self.context.line_to(582,152)
self.context.line_to(254,152)
self.context.stroke()
if __name__ == "__main__":
aff = fenetre()
gtk.main() |
Partager