From 3c172d34e0a83503806ea743af053331ffb9cefc Mon Sep 17 00:00:00 2001 From: kriss Date: Tue, 25 Mar 2008 20:06:27 +0000 Subject: [PATCH] MANAGE: Adding directory to archiv patches. git-svn-id: http://www.neo1973-germany.de/svn@67 46df4e5c-bc4e-4628-a0fc-830ba316316d --- .../trunk/patches/pyPenNotesListEmptied.patch | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 pyPenNotes/trunk/patches/pyPenNotesListEmptied.patch diff --git a/pyPenNotes/trunk/patches/pyPenNotesListEmptied.patch b/pyPenNotes/trunk/patches/pyPenNotesListEmptied.patch new file mode 100644 index 0000000..a726d92 --- /dev/null +++ b/pyPenNotes/trunk/patches/pyPenNotesListEmptied.patch @@ -0,0 +1,97 @@ +Index: ../src/pyPenNotes.py +=================================================================== +--- ../src/pyPenNotes.py (revisjon 65) ++++ ../src/pyPenNotes.py (arbeidskopi) +@@ -399,52 +399,54 @@ + + data_file_name = os.path.expanduser(DATA_FILE) + +- if not os.path.exists(data_file_name): +- print "No notebook file found - using an empty one." +- return +- +- file_fd = open(data_file_name, 'r') +- try: +- for line in file_fd.read().split('\n'): +- comma_values = line.split(",") +- if len(comma_values) >= 2: ## at least 1 coord +- fg_color = int(comma_values[0]) +- bg_color = int(comma_values[1]) +- self.current_note.bg_color = bg_color +- thickness = int(comma_values[2].split(";")[0]) +- if len(line.split(";")[1].rstrip()) <= 0: +- continue +- new_stroke = True +- for coord in line.split("; ")[1].split(" "): +- coords = coord.split(",") +- if len(coords) <= 1: ++ if os.path.exists(data_file_name): ++ file_fd = open(data_file_name, 'r') ++ try: ++ for line in file_fd.read().split('\n'): ++ comma_values = line.split(",") ++ if len(comma_values) >= 2: ## at least 1 coord ++ fg_color = int(comma_values[0]) ++ bg_color = int(comma_values[1]) ++ self.current_note.bg_color = bg_color ++ thickness = int(comma_values[2].split(";")[0]) ++ if len(line.split(";")[1].rstrip()) <= 0: + continue +- ## first point +- if new_stroke: +- self.current_note.append_new_point((int(coords[0]), \ +- int(coords[1])), fg_color, thickness) ++ new_stroke = True ++ for coord in line.split("; ")[1].split(" "): ++ coords = coord.split(",") ++ if len(coords) <= 1: ++ continue ++ ## first point ++ if new_stroke: ++ self.current_note.append_new_point((int(coords[0]), \ ++ int(coords[1])), fg_color, thickness) + +-# self.current_note.strokes_list.append(int(coords[0]), \ +-# int(coords[1]))) ++# self.current_note.strokes_list.append(int(coords[0]), \ ++# int(coords[1]))) + +- self.current_note.append_point_to_stroke((int(coords[0]), \ +- int(coords[1]))) ++ self.current_note.append_point_to_stroke((int(coords[0]), \ ++ int(coords[1]))) + +- new_stroke = False +- else: +- if len(line) >= 1: +- count += 1 +- self.current_note = PenNote() +- self.pen_notes.append(self.current_note) +- finally: +- file_fd.close() ++ new_stroke = False ++ else: ++ if len(line) >= 1: ++ count += 1 ++ self.current_note = PenNote() ++ self.pen_notes.append(self.current_note) ++ finally: ++ file_fd.close() ++ else: ++ print "No notebook file found - using an empty one." ++ count += 1 ++ self.current_note = PenNote() ++ self.pen_notes.append(self.current_note) + + print "count: %s, current: %s" %(count, self.current_note_number) + if count <= self.current_note_number: +- print "Sorry there is no note %4.4d left bringing you to note 0001" ++ print "Sorry there is no note %4.4d left bringing you to note 0001" % (count + 1) # Count is zero-indexed, while what is displayed to the user is not + self.current_note_number = 0 +- self.next_note(None) +- self.prev_note(None) ++ self.next_note(None) # Update the note number box ++ self.prev_note(None) # + + self.current_note = self.pen_notes[self.current_note_number] + self.redraw()