Ejemplo n.º 1
0
 def keyPressEvent(self, event):
     if event.key() == Qt.Key_PageUp:
         self.zoom = str(int(self.zoom) + 1)
         MapAPI(self.coords, self.zoom, self.mod).draw()
     elif event.key() == Qt.Key_PageDown:
         self.zoom = str(int(self.zoom) - 1)
         MapAPI(self.coords, self.zoom, self.mod).draw()
Ejemplo n.º 2
0
 def __init__(self):
     super().__init__()
     self.coords = ['140.232', '40.214']
     self.zoom = '15'
     self.mod = 'sat'
     MapAPI(self.coords, self.zoom, self.mod).draw()
     self.initUI()
Ejemplo n.º 3
0
class Main(QWidget):
    def __init__(self):
        super().__init__()
        self.map_api = MapAPI()  # сама карта
        self.map_api.draw()
        self.initUI()

    def initUI(self):
        self.setGeometry(200, 100, *SCREEN_SIZE)
        self.setWindowTitle('Отображение карты')

        ## Изображение
        self.pixmap = QPixmap('map.png')
        self.image = QLabel(self)
        self.image.move(0, 0)
        self.image.resize(600, 450)
        self.image.setPixmap(self.pixmap)

        self.poshuk = QLineEdit(self)
        self.poshuk.move(10, 460)
        self.poshuk.resize(475, 25)

        self.btn = QPushButton('Search', self)
        self.btn.resize(self.btn.sizeHint())
        self.btn.move(490, 460)
        self.btn.clicked.connect(self.run)

    def closeEvent(self, event):
        """При закрытии формы подчищаем за собой"""
        os.remove(self.map_file)

    def keyPressEvent(self, event):
        if event.key() == Qt.Key_PageUp and int(self.map_api.zoom) < 17:
            self.map_api.zoom = str(int(self.map_api.zoom) + 1)
            self.map_api.draw()
            self.image.setPixmap(QPixmap('map.png'))
        elif event.key() == Qt.Key_PageDown and int(self.map_api.zoom) > 0:
            self.map_api.zoom = str(int(self.map_api.zoom) - 1)
            self.map_api.draw()
            self.image.setPixmap(QPixmap('map.png'))
        elif event.key() == Qt.Key_Left:
            pass
        elif event.key() == Qt.Key_Right:
            pass
        elif event.key() == Qt.Key_Up:
            pass
        elif event.key() == Qt.Key_Down:
            pass
        elif event.key() == Qt.Key_End:
            self.map_api.mod += 1
            self.map_api.draw()
            self.image.setPixmap(QPixmap('map.png'))

    def run(self):
        print(self.sender().text())
Ejemplo n.º 4
0
 def __init__(self):
     super().__init__()
     self.map_api = MapAPI()  # сама карта
     self.map_api.draw()
     self.initUI()
Ejemplo n.º 5
0
class Main(QWidget):
    def __init__(self):
        super().__init__()
        self.map_api = MapAPI()  # сама карта
        self.map_api.draw()
        self.initUI()

    def initUI(self):
        self.setGeometry(200, 100, *SCREEN_SIZE)
        self.setWindowTitle('Отображение карты')

        ## Изображение
        self.pixmap = QPixmap('map.png')
        self.image = QLabel(self)
        self.image.move(0, 0)
        self.image.resize(600, 450)
        self.image.setPixmap(self.pixmap)

    def closeEvent(self, event):
        """При закрытии формы подчищаем за собой"""
        os.remove(self.map_file)

    def keyPressEvent(self, event):
        if event.key() == Qt.Key_PageUp and int(self.map_api.zoom) < 17:
            self.map_api.zoom = str(int(self.map_api.zoom) + 1)
            self.map_api.draw()
            self.image.setPixmap(QPixmap('map.png'))
        elif event.key() == Qt.Key_PageDown and int(self.map_api.zoom) > 0:
            self.map_api.zoom = str(int(self.map_api.zoom) - 1)
            self.map_api.draw()
            self.image.setPixmap(QPixmap('map.png'))
        elif event.key() == Qt.Key_Left and int(
                self.map_api.cords[0]) - 3 >= 0:
            self.map_api.cords[0] = str(int(self.map_api.cords[0]) - 3)
            self.map_api.draw()
            self.image.setPixmap(QPixmap('map.png'))
        elif event.key() == Qt.Key_Right and int(
                self.map_api.cords[0]) + 3 <= 180:
            self.map_api.cords[0] = str(int(self.map_api.cords[0]) + 3)
            self.map_api.draw()
            self.image.setPixmap(QPixmap('map.png'))
        elif event.key() == Qt.Key_Up and int(self.map_api.cords[1]) + 2 <= 90:
            self.map_api.cords[1] = str(int(self.map_api.cords[1]) + 2)
            self.map_api.draw()
            self.image.setPixmap(QPixmap('map.png'))
        elif event.key() == Qt.Key_Down and int(
                self.map_api.cords[1]) - 2 >= -90:
            self.map_api.cords[1] = str(int(self.map_api.cords[1]) - 2)
            self.map_api.draw()
            self.image.setPixmap(QPixmap('map.png'))
Ejemplo n.º 6
0
 def __init__(self):
     super().__init__()
     MapAPI(['140.232', '40.214'], '15', 'sat').draw()
     self.initUI()