Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _create_frame(self, qti: QTrackItem, frm: FrameInfo) -> QFrameItem:
qfi = QFrameItem(qti, self.coords, frm.uuid, frm.when.s, frm.when.d, _translate_to_visual_state(frm.state),
frm.primary, frm.secondary)
return qfi
def _test_populate(self):
from uuid import uuid1 as uuidgen
once = datetime.utcnow()
def minutes_td(minutes):
return timedelta(minutes=minutes)
# assert(hasattr(self, '_track_order'))
self._span = Span(once - minutes_td(10), minutes_td(30))
track0 = QTrackItem(self, self.coords, 'IMAGE:test::timeline:GOES-21:QBI:mars', 1,
"G21 QBI B99 BT", "test track", tooltip="peremptorily cromulent")
# scene.addItem(abitrack) # done in init
frame01 = QFrameItem(track0, self.coords, uuidgen(), once + minutes_td(5), minutes_td(5),
Flags([VisualState.BUSY]), "abi1", "fulldiskimus")
track1 = QTrackItem(self, self.coords, 'IMAGE:test::timeline:Himawari-11:AHI:mars', 0,
"H11 AHI B99 Rad", "second test track", tooltip="nominally cromulent")
frame11 = QFrameItem(track1, self.coords, uuidgen(), once + minutes_td(6), minutes_td(1),
Flags([VisualState.READY]), "ahi1", "JP04")
# self.insert_track(track0)
# self.insert_track(track1)
# assert(hasattr(self, '_propagate_max_z'))
self.propagate_max_z()
for track in [track0, track1]:
track.update_pos_bounds()
track.update_frame_positions()
# scene.addItem(frame1) # done in init
# blabla = QGraphicsTextItem('abcdcba')
# font = QFont('White Rabbit')
# blabla.setFont(font)
# coordinate transform between track Z order and time to scene float x,y,w,h
_coords: CoordTransform = None
# rulers at top and/or bottom of scene; QGraphicsItems have to be retained in python to avoid confusing Qt
_top_ruler_item: QTimeRulerItem = None
_bottom_ruler_item: QTimeRulerItem = None
_ruler_tick_interval: timedelta = None
# cursor information
_cursor_time: datetime = None
_cursor_duration: timedelta = None
# content representing document / workspace / scenegraph
_track_items: Mapping[str, QTrackItem] = None # retain QTrackItem objects lest they disappear; also bookkeeping
_frame_items: Mapping[UUID, QFrameItem] = None # likewise for QFrameItems
_decor_items: Mapping[Any, QGraphicsItem] = None # decoration items
# styling settings
_track_pen_brush = None, None
_frame_pen_brush = None, None
# _frame_states_allowed = None # allow filtering of frames and tracks for thinned views
def __init__(self):
super(QFramesInTracksScene, self).__init__()
self._coords = CoordTransform()
self._track_items = {}
self._frame_items = {}
pen = QPen()
pen.setWidthF(1.25)
pen.setColor(Qt.black)
def _test_populate(self):
from uuid import uuid1 as uuidgen
once = datetime.utcnow()
def minutes_td(minutes):
return timedelta(minutes=minutes)
# assert(hasattr(self, '_track_order'))
self._span = Span(once - minutes_td(10), minutes_td(30))
track0 = QTrackItem(self, self.coords, 'IMAGE:test::timeline:GOES-21:QBI:mars', 1,
"G21 QBI B99 BT", "test track", tooltip="peremptorily cromulent")
# scene.addItem(abitrack) # done in init
frame01 = QFrameItem(track0, self.coords, uuidgen(), once + minutes_td(5), minutes_td(5),
Flags([VisualState.BUSY]), "abi1", "fulldiskimus")
track1 = QTrackItem(self, self.coords, 'IMAGE:test::timeline:Himawari-11:AHI:mars', 0,
"H11 AHI B99 Rad", "second test track", tooltip="nominally cromulent")
frame11 = QFrameItem(track1, self.coords, uuidgen(), once + minutes_td(6), minutes_td(1),
Flags([VisualState.READY]), "ahi1", "JP04")
# self.insert_track(track0)
# self.insert_track(track1)
# assert(hasattr(self, '_propagate_max_z'))
self.propagate_max_z()
for track in [track0, track1]:
track.update_pos_bounds()
track.update_frame_positions()
# scene.addItem(frame1) # done in init
# blabla = QGraphicsTextItem('abcdcba')
# font = QFont('White Rabbit')
# blabla.setFont(font)
# blabla.setPos(140, 100)
# self.addItem(blabla)
# blabla = None
self.content = [track0, frame01, track1, frame11]