Exemplo n.º 1
0
    def __init__(self, screen, x, y, width, height, vertical, frame1):
        log.debug("SplitFrame.__init__")
        Frame.__init__(self, screen, x, y, width, height)
        self.split_dragging = False
        self.vertical = vertical

        if vertical:
            self.split = height
        else:
            self.split = width
        self.split = self.split >> 1

        self.frame1 = frame1

        if vertical:
            self.frame1.moveresize(x, y, self.width, self.height - self.split)
            # this is a horrible hack to get around circular importing
            self.frame2 = self.frame1.topmost_child().__class__(
                self.screen, self.x, self.y + self.split + 4, self.width,
                self.height - self.split - 4)
        else:
            self.frame1.moveresize(x, y, self.width - self.split, self.height)
            self.frame2 = self.frame1.topmost_child().__class__(
                self.screen, self.x + self.split + 4, self.y,
                self.width - self.split - 4, self.height)

        frame1.tritium_parent.replace_me(frame1, self)

        self.frame1.tritium_parent = self.frame2.tritium_parent = self
        self.frame1.activate()

        self.create_split_window()
Exemplo n.º 2
0
    def __init__(self, screen, game):
        ''' An example class to show how to creat custom GUI frames'''
        Frame.__init__(self, screen, (330, 110), (10, 10))

        self.game = game

        self.b1 = Button(self, "Toggle Constant", self.command)
        self.b2 = Button(self,
                         "Toggle Random",
                         self.command2,
                         position=(5, 40))
        self.b3 = Button(self, "Toggle Shape", self.command3, position=(5, 75))

        self.c_Label = Label(self, "False", position=(135, 10))
        self.r_Label = Label(self, "True", position=(135, 45))
        self.s_Label = Label(self, "Random", position=(135, 80))

        self.l1 = Label(self, "Size", position=(235, 10))
        self.tb1 = TextBox(self, (295, 10))

        self.l2 = Label(self, "Density", position=(235, 45))
        self.tb2 = TextBox(self, (295, 45))

        self.l3 = Label(self, "Speed", position=(235, 80))
        self.tb3 = TextBox(self, (295, 80))

        self.textboxes = {
            'size': self.tb1,
            'density': self.tb2,
            'speed': self.tb3
        }
        self.current = 'circle'
Exemplo n.º 3
0
    def __init__(self, screen, game):
        ''' An example class to show how to creat custom GUI frames'''
        Frame.__init__(self, screen, (330, 110), (10, 10))

        self.game = game

        self.b1 = Button(self, "Toggle Constant", self.command)
        self.b2 = Button(self, "Toggle Random", self.command2, position=(5,40))
        self.b3 = Button(self, "Toggle Shape", self.command3, position=(5, 75))

        self.c_Label = Label(self, "False", position=(135, 10))
        self.r_Label = Label(self, "True", position=(135, 45))
        self.s_Label = Label(self, "Random", position=(135, 80))

        self.l1 = Label(self, "Size", position=(235, 10))
        self.tb1 = TextBox(self, (295, 10))

        self.l2 = Label(self, "Density", position=(235, 45))
        self.tb2 = TextBox(self, (295, 45))

        self.l3 = Label(self, "Speed", position=(235, 80))
        self.tb3 = TextBox(self, (295, 80))
        
        self.textboxes = {'size' : self.tb1,
                        'density' : self.tb2,
                        'speed' : self.tb3}
        self.current = 'circle'
Exemplo n.º 4
0
    def __init__( self, screen, x, y, width, height, vertical, frame1 ):
        log.debug( "SplitFrame.__init__" )
        Frame.__init__( self, screen, x, y, width, height )
        self.split_dragging = False
        self.vertical = vertical

        if vertical:
            self.split = height
        else:
            self.split = width
        self.split = self.split >> 1

        self.frame1 = frame1

        if vertical:
            self.frame1.moveresize( x, y, self.width, self.height - self.split )
            # this is a horrible hack to get around circular importing
            self.frame2 = self.frame1.topmost_child().__class__( self.screen, self.x, self.y + self.split+4,
                                                 self.width, self.height-self.split-4)
        else:
            self.frame1.moveresize( x, y, self.width - self.split, self.height )
            self.frame2 = self.frame1.topmost_child().__class__( self.screen, self.x + self.split+4, self.y,
                                                 self.width-self.split-4, self.height)

        frame1.tritium_parent.replace_me( frame1, self )

        self.frame1.tritium_parent = self.frame2.tritium_parent = self
        self.frame1.activate()

        self.create_split_window()
Exemplo n.º 5
0
 def __init__(self,
              root_console_width,
              root_console_height,
              frame_manager=None):
     Frame.__init__(self, root_console_width, root_console_height,
                    frame_manager)
     self.text_base = root_console_width / 2, root_console_height / 4
     self.title_text = "ROGUEP: A Game of Viruses"
     self.option_one_text = "Play"
     self.option_two_text = "Quit"
Exemplo n.º 6
0
 def __init__(self, rect, font, name=None):
     Frame.__init__(self, rect)
     self.active = True
     self.font = font
     self.textcolor = BUTTONTEXTCOLOR
     self.backgroundcolor = BUTTONBACKGROUNDCOLOR
     self.name = name
     self.textframe = None
     
     # Margins
     self.top = 1
Exemplo n.º 7
0
 def __init__(self, rect, font):
     Frame.__init__(self, rect)
     self.active = True
     self.font = font
     self.textcolor = TEXTCOLOR
     self.name = None
     self.lines = []
     
     # Margins
     self.top = 1
     self.bottom = 1
     self.left = 1
     self.right = 1
Exemplo n.º 8
0
 def next(self):
     
     if self._closed: 
         raise ValueError('I/O operation on closed file')
     nfi = self._nfi
     if nfi < self._n_csets:
         unitcell = self._nextUnitcell()
         coords = self._nextCoordset()
         if self._ag is None:
             frame = Frame(self, nfi, coords, unitcell)
         else:
             frame = self._frame
             Frame.__init__(frame, self, nfi, None, unitcell)
         return frame
Exemplo n.º 9
0
    def __init__(self, rect, font):
        Frame.__init__(self, rect)
        self.active = True
        self.font = font
        self.textcolor = TEXTCOLOR
        self.name = None
        self.lines = ['']
        self.char_limit = 40
        self.textframe = None
 
        # Margins
        self.top = 1
        self.right = 1
        self.left = 1
Exemplo n.º 10
0
    def __init__(self, frame, img=None):
        KeyFrameGraph.__init__(self)
        Frame.__init__(
            self,
            img=None,
            camera=frame.camera,
            pose=frame.pose,
            id=frame.id,
            timestamp=frame.timestamp
        )  # here we MUST have img=None in order to avoid recomputing keypoint info

        if frame.img is not None:
            self.img = frame.img  # this is already a copy of an image
        else:
            if img is not None:
                self.img = img.copy()

        self.map = None

        self.is_keyframe = True
        self.kid = None  # keyframe id

        self._is_bad = False
        self.to_be_erased = False

        # pose relative to parent (this is computed when bad flag is activated)
        self._pose_Tcp = CameraPose()

        # share keypoints info with frame (these are computed once for all on frame initialization and they are not changed anymore)
        self.kps = frame.kps  # keypoint coordinates                  [Nx2]
        self.kpsu = frame.kpsu  # [u]ndistorted keypoint coordinates    [Nx2]
        self.kpsn = frame.kpsn  # [n]ormalized keypoint coordinates     [Nx2] (Kinv * [kp,1])
        self.octaves = frame.octaves  # keypoint octaves                      [Nx1]
        self.sizes = frame.sizes  # keypoint sizes                        [Nx1]
        self.angles = frame.angles  # keypoint angles                       [Nx1]
        self.des = frame.des  # keypoint descriptors                  [NxD] where D is the descriptor length

        if hasattr(frame, '_kd'):
            self._kd = frame._kd
        else:
            Printer.orange('KeyFrame %d computing kdtree for input frame %d' %
                           (self.id, frame.id))
            self._kd = cKDTree(self.kpsu)

        # map points information arrays (copy points coming from frame)
        self.points = frame.get_points(
        )  # map points => self.points[idx] is the map point matched with self.kps[idx] (if is not None)
        self.outliers = np.full(
            self.kpsu.shape[0], False,
            dtype=bool)  # used just in propagate_map_point_matches()
Exemplo n.º 11
0
    def __init__(self):
        Frame.__init__(self)
        self.main = Main()
        self.cant_clients = 0
        self.layout_add(self.main)

        self.state_has_changed(self.STATE)

        thread = threading.Thread(target=self.upd_ui)
        thread.setName('Frame')
        thread.setDaemon(True)
        thread.start()

        self.connect(self, SIGNAL("state_changed"), self.state_has_changed)
        self.connect(self.trayIcon, SIGNAL("messageClicked()"),
                     self.message_clicked)
        # self.connect(self.trayIcon, SIGNAL("activated(QString)"), self.icon_activated)NO BORRAR
        # todo no encuentro la forma de conectar trayIcon a activated usando el nuevo estilo(ver comentario de arriba)
        self.trayIcon.activated.connect(self.icon_activated)
Exemplo n.º 12
0
 def next(self):
     
     if self._closed: 
         raise ValueError('I/O operation on closed file')
     nfi = self._nfi
     if nfi < self._n_csets:
         traj = self._trajectory
         while traj._nfi == traj._n_csets:
             self._nextFile()
             traj = self._trajectory
         unitcell = traj._nextUnitcell()
         coords = traj._nextCoordset()
                     
         if self._ag is None:
             frame = Frame(self, nfi, coords, unitcell)
         else:
             frame = self._frame
             Frame.__init__(frame, self, nfi, None, unitcell)
             self._ag.setACSLabel(self._title + ' frame ' + str(self._nfi))
         self._nfi += 1
         return frame
Exemplo n.º 13
0
	def __init__(self, root_console_width, root_console_height, frame_manager=None):
		Frame.__init__(self, root_console_width, root_console_height, frame_manager)
		self.text_base = root_console_width/2, root_console_height/4
		self.title_text = "ROGUEP: A Game of Viruses"
		self.option_one_text = "Play"
		self.option_two_text = "Quit"
Exemplo n.º 14
0
 def __init__(self, screen, x, y, width, height):
     log.debug("TabbedFrame.__init__")
     Frame.__init__(self, screen, x, y, width, height)
     self.tabs = Tabs(self)
Exemplo n.º 15
0
 def __init__( self, screen, x, y, width, height ):
     log.debug( "TabbedFrame.__init__" )
     Frame.__init__( self, screen, x, y, width, height )
     self.tabs = Tabs( self )