Changeset 422
- Timestamp:
- 07/27/2011 04:03:57 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
SHX/trunk/sandbox/traceplotter.py
r421 r422 689 689 690 690 if self.traceOrder in [0, 1]: 691 PARTS = 5. 691 692 w = width - MARGIN-STATION_INFO 692 693 y = height - TIMESCALE + 10 … … 694 695 canvas.DrawLine(sx, y, w+STATION_INFO, y) 695 696 696 chunk = w / 5.697 chunk = w / PARTS 697 698 chunk2 = chunk / 5. 698 chunk_t = (end - start) / 5.699 for i in range( 5):699 chunk_t = (end - start) / PARTS 700 for i in range(int(PARTS)): 700 701 if isinstance(start, UTCDateTime): 701 702 timecode = start + i*chunk_t … … 712 713 canvas.DrawLine(x+j*chunk2, y, x+j*chunk2, y+3) 713 714 elif self.traceOrder in [2, 3]: 714 # XXX 715 h = height-MARGIN-STATION_INFO 715 PARTS = 4. 716 h = height - MARGIN - STATION_INFO 717 x = width - TIMESCALE + 10 718 if self.traceOrder == 2: 719 sy = MARGIN 720 elif self.traceOrder == 3: 721 sy = STATION_INFO 722 canvas.DrawLine(x, sy, x, sy+h) 723 724 chunk = h / PARTS 725 chunk2 = chunk / 5. 726 chunk_t = (end - start) / PARTS 727 728 for i in range(int(PARTS)): 729 if isinstance(start, UTCDateTime): 730 timecode = start + i*chunk_t 731 txt = timecode.strftime("%H:%M:%S.") + \ 732 str(timecode.microsecond//1000) 733 else: 734 txt = str(start + i*chunk_t) 735 736 tw, _, _, _ = canvas.GetFullTextExtent(txt) 737 if self.traceOrder == 2: 738 y = sy + (PARTS-i) * chunk 739 elif self.traceOrder == 3: 740 y = sy + i * chunk 741 canvas.DrawRotatedText(txt, x+8, y+tw/2, 90) 742 canvas.DrawLine(x, y, x+7, y) 743 for j in range(1, 5): 744 if self.traceOrder == 2: 745 j -= 5 746 canvas.DrawLine(x, y+j*chunk2, x+3, y+j*chunk2) 716 747 717 748 # make it visible
Note: See TracChangeset
for help on using the changeset viewer.