Ejemplo n.º 1
0
    def initUI(self, newkey={}, mapId=None):
        key = {'usage': 'dw', 'name': 'footmen', 'flag': 'red', 'action':'right', \
               'oil':int(resource.basicData['gf'][newkey['name']]['oil']), \
               'bullect':int(resource.basicData['gf'][newkey['name']]['oil']), \
               'blood':10, 'moved':False, 'occupied':0, 'loadings':[], 'isDiving':False, 'isStealth':False, 'supplies': {}}
        key.update(newkey)
        # print(key)
        if isinstance(mapId, list):
            self.mapId = tuple(mapId)
        else:
            self.mapId = mapId
        self.bodySize = (100, 100)
        self.resize(self.bodySize[0], self.bodySize[1])
        self.occupied = key['occupied']
        self.loadings = key['loadings']
        self.bloodSize = 30
        self.isStealth = key['isStealth']
        self.isDiving = key['isDiving']
        self.bloodValue = key['blood']
        self.oil = key['oil']
        self.bullect = key['bullect']
        self.moved = key['moved']
        self.supplies = key['supplies']
        del key['blood'], key['oil'], key['bullect']
        self.bloodFont = QFont('宋体', self.bloodSize)
        self.statusSize = 40, 40
        self.statusList = [None for i in range(7)]
        self.statusPoint = 0

        self.body = QLabel(self)
        self.track = resource.find(key)
        pm = self.track['pixmap'].scaled(self.bodySize[0], self.bodySize[1])
        self.body.setPixmap(pm)

        tem_box = QFrame(self, QtCore.Qt.FramelessWindowHint)
        tem_layout = QBoxLayout(QBoxLayout.BottomToTop, tem_box)
        self.status = QLabel(tem_box)
        self.blood = QLabel('', tem_box)
        self.blood.setStyleSheet('color:white;')
        self.doBlood(self.bloodValue)
        self.blood.setAlignment(QtCore.Qt.AlignBottom)
        self.blood.setFont(self.bloodFont)

        tem_layout_2 = QBoxLayout(QBoxLayout.LeftToRight, tem_box)
        tem_layout_2.addWidget(self.blood)
        tem_layout_2.addStretch(1)
        tem_layout_2.addWidget(self.status)
        tem_layout.addLayout(tem_layout_2)
        tem_layout.addStretch(1)
        tem_box.setLayout(tem_layout)

        layout = QStackedLayout(self)
        layout.setStackingMode(QStackedLayout.StackAll)
        layout.addWidget(tem_box)
        layout.addWidget(self.body)
        self.setLayout(layout)
        self.status.clear()
Ejemplo n.º 2
0
 def change(self, flag):
     track = resource.find({
         'usgae': 'dw',
         'name': self.track['name'],
         'flag': flag,
         'action': self.track['action']
     })
     self.track.update(track)
     self.doBody(self.track['action'])
Ejemplo n.º 3
0
 def doBody(self, str):
     track = self.track.copy()
     track['action'] = str
     del track['base64']
     del track['pixmap']
     tem = resource.find(track)
     if tem:
         pm = tem['pixmap'].scaled(round(self.bodySize[0]), round(self.bodySize[1]))
         self.body.setPixmap(pm)
         self.track = tem
Ejemplo n.º 4
0
 def change(self, string=None, track=None):
     if string:
         track = self.track.copy()
         track['name'] = string
         tem = resource.find(track)
     else:
         tem = track
     if tem:
         self.setPixmap(tem['pixmap'].scaled(self.width(), self.height()))
         self.track = track
Ejemplo n.º 5
0
 def doStatus(self, str):
     '''ok, oil, bullet, occupy, loading, supplies, diving, stealth'''
     if str == None:
         self.status.clear()
     else:
         self.status.setPixmap(
             QPixmap(
                 resource.find({
                     'usage': 'dw2',
                     'name': str
                 })['pixmap']).scaled(round(self.statusSize[0]),
                                      round(self.statusSize[1])))
Ejemplo n.º 6
0
    def __init__(self, parent, newKey={}, mapId=None, brother=None):
        super(Geo, self).__init__(parent)
        key = {'usage': 'geo', 'name': 'plain'}
        key.update(newKey)
        if isinstance(mapId, list):
            self.mapId = tuple(mapId)
        else:
            self.mapId = mapId
        self.resize(100, 100)
        self.size_ = self.width(), self.height()
        if 'pixmap' not in key:
            key['pixmap'] = resource.find(key)['pixmap']
        self.track = key
        self.setPixmap(key['pixmap'].scaled(self.width(), self.height()))
        self.setScaledContents(True)
        self.setFrameShape(QFrame.Box)
        self.setFrameShadow(QFrame.Raised)
        self.setLineWidth(0)

        self.brother = brother

        self.setFrameShape(QFrame.Box)
        self.setFrameShadow(QFrame.Raised)
        self.setLineWidth(0)