示例#1
0
    def save_uuid(self, uuid: QUuid) -> str:
        """ Store a Quuid and return a integer id as string to minimize file save/load effort.
            This method should only be used on file saving!
        """
        uuid_str = uuid.toString()

        if uuid_str in self.item_ids:
            return self.item_ids[uuid_str]

        self.str_ids += 1
        str_id = str(self.str_ids)
        self.item_ids[uuid_str] = str_id
        return str_id
 def testFromString(self):
     uuidString = '{fc69b59e-cc34-4436-a43c-ee95d128b8c5}'
     uuid = QUuid(uuidString)
     self.assertTrue(not uuid.isNull())
     self.assertEqual(uuid.toString(), uuidString)