Esempio n. 1
0
    def __init__(self):
        super().__init__()
        self.workingPath = os.path.dirname(__file__).replace("\\", "/")
        self.ui = QtCompat.loadUi(
            self.workingPath + "/uiFiles/nodeInfoPanel.ui", self)
        self.setWindowTitle("Node Information")

        self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
        self.width = 400
        self.height = 600
        self.resize(self.width, self.height)
        self.nodeInfoWidget.setFixedHeight(100)

        self.screenSize = QtWidgets.QDesktopWidget().screenGeometry()
        self.screenWidth = self.screenSize.width()
        self.screenHeight = self.screenSize.height()

        self.attribTextEdits = {
            "vertex": self.ui.vertexAttrText,
            "edge": self.ui.edgeAttrText,
            "face": self.ui.faceAttrText,
            "detail": self.ui.detailAttrText
        }

        self.attribLabels = {
            "vertex": self.ui.label_23,
            "edge": self.ui.label,
            "face": self.ui.label_3,
            "detail": self.ui.label_6
        }

        self.node = None
        self._always_show = False
Esempio n. 2
0
    def init_ui(self):
        screen_size = QtWidgets.QDesktopWidget().screenGeometry()
        self.setWindowTitle(self.title)
        self.setGeometry((screen_size.width() - self.size["w"]) / 2,
                         (screen_size.height() - self.size["h"]) / 2,
                         self.size["w"], self.size["h"])

        allies_lay = QtWidgets.QVBoxLayout()
        allies_lay.addWidget(QtWidgets.QLabel("Allies:"))
        for each in self.allies:
            allies_lay.addWidget(each)

        enemies_lay = QtWidgets.QVBoxLayout()
        enemies_lay.addWidget(QtWidgets.QLabel("Enemies:"))
        for each in self.enemies:
            enemies_lay.addWidget(each)

        heroes_lay = QtWidgets.QHBoxLayout()
        heroes_lay.addLayout(allies_lay)
        heroes_lay.addLayout(enemies_lay)

        layout = QtWidgets.QVBoxLayout()
        layout.addLayout(heroes_lay)
        layout.addWidget(self.moniter)
        layout.addWidget(self.refresh)

        self.setLayout(layout)
Esempio n. 3
0
 def _show_full(self):
     self._is_full = True
     # self.showFullScreen()
     self._normal_rect = self.geometry()
     # self._normal_rect
     screen = QtWidgets.QApplication.desktop().screenNumber(
         QtWidgets.QApplication.desktop().cursor().pos())
     _rect = QtWidgets.QDesktopWidget().availableGeometry(screen=screen)
     self.setGeometry(_rect)
Esempio n. 4
0
    def __init__(self, notice):
        ui_path = ('/').join([os.path.dirname(__file__), 'ui', TITLE + '.ui'])
        self.wgNotice = QtCompat.loadUi(ui_path)
        self.notice = notice

        self.wgNotice.btnCancel.clicked.connect(self.press_btnCancel)
        self.wgNotice.btnPreviewImg.clicked.connect(self.press_btnPreviewImg)

        self.wgNotice.edtTitle.setText(self.notice.title)
        self.wgNotice.edtMsg.setPlainText(self.notice.msg)
        if self.notice.quote:
            self.notice.quote = '"{}"'.format(self.notice.quote)
        self.wgNotice.edtQuote.setPlainText(self.notice.quote)

        self.wgNotice.btnUser.setIcon(
            QtGui.QPixmap(
                QtGui.QImage(Tank().get_img_path('user/' + self.notice.user))))
        self.wgNotice.btnUser.setToolTip(
            ('').join([self.notice.user, '\n', self.notice.time]))
        self.wgNotice.btnUser.clicked.connect(pipefunc.help)

        self.wgNotice.edtTitle.setText(self.notice.title)

        self.open_link = self.notice.img_link
        self.wgNotice.btnPreviewImg.setToolTip(self.open_link)

        # if not os.path.exists(self.notice.img): self.notice.img = Tank().get_img_path(self.notice.img)
        self.wgNotice.btnPreviewImg.setIcon(
            QtGui.QPixmap(QtGui.QImage(self.notice.img)))
        # if self.notice.func: self.wgNotice.lblFunc.setText(self.notice.func)
        # else:                self.wgNotice.lblFunc.hide()
        if not self.notice.img_link:
            self.wgNotice.btnPreviewImg.setEnabled(False)
        # self.wgNotice.btnCancel.hide()

        # WIDGET : delete border & always on top
        self.wgNotice.setWindowFlags(QtCore.Qt.CustomizeWindowHint
                                     | QtCore.Qt.FramelessWindowHint
                                     | QtCore.Qt.Tool
                                     | QtCore.Qt.WindowStaysOnTopHint)

        # WIDGET : move to right low corner
        resolution = QtWidgets.QDesktopWidget().screenGeometry()
        self.wgNotice.move(resolution.width() - self.wgNotice.width() - 10,
                           resolution.height() - self.wgNotice.height() - 75)
        self.wgNotice.setWindowOpacity(0.9)

        # round edges
        path = QtGui.QPainterPath()
        path.addRoundedRect(QtCore.QRectF(self.wgNotice.rect()), 3.0, 3.0)
        self.wgNotice.setMask(QtGui.QRegion(path.toFillPolygon().toPolygon()))

        self.wgNotice.show()

        self.start_timer()
        LOG.info(notice)
Esempio n. 5
0
 def build_ui(self):
     if self.settings.value("geometry"):
         self.restoreGeometry(self.settings.value("geometry"))
     else:
         sizeObject = QtWidgets.QDesktopWidget().screenGeometry(-1)
         self.resize(sizeObject.width() * 0.8, sizeObject.height() * 0.8)
     
     self.setWindowFlags(
         self.windowFlags() | QtCore.Qt.WindowMinimizeButtonHint | QtCore.Qt.WindowMaximizeButtonHint)
     
     self.top_layout = QtWidgets.QVBoxLayout()
     self.top_layout.setContentsMargins(0, 0, 0, 0)
     self.setLayout(self.top_layout)
Esempio n. 6
0
    def undercursor(self):
        def clamp(val, mi, ma):
            return max(min(val, ma), mi)

        # Get cursor position, and screen dimensions on active screen
        cursor = QtGui.QCursor().pos()
        screen = QtWidgets.QDesktopWidget().screenGeometry(cursor)

        # Get window position so cursor is just over text input
        xpos = cursor.x() - (self.width() / 2)
        ypos = cursor.y() - 13

        # Clamp window location to prevent it going offscreen
        xpos = clamp(xpos, screen.left(), screen.right() - self.width())
        ypos = clamp(ypos, screen.top(),
                     screen.bottom() - (self.height() - 13))

        # Move window
        self.move(xpos, ypos)
Esempio n. 7
0
    def __init__(self, *args, **kwargs):
        super(ScreenWidget, self).__init__(*args, **kwargs)

        self.center_pos = None
        self.start_pos = None
        self.end_pos = None
        self.pixmap = None
        self.current_screen = 99

        self._dt = QtWidgets.QDesktopWidget()

        self._timer_move_screen = QtCore.QTimer()
        self._timer_move_screen.setInterval(150)

        self._timer_draw_screen = QtCore.QTimer()
        self._timer_draw_screen.setInterval(25)

        self._check_mouse_position()
        self._setup_ui()
        self._build_connections()

        self._timer_move_screen.start()
        self.setMouseTracking(True)
Esempio n. 8
0
    def build_ui(self):

        if self.settings.value("geometry"):
            self.restoreGeometry(self.settings.value("geometry"))
        else:
            sizeObject = QtWidgets.QDesktopWidget().screenGeometry(-1)
            self.resize(sizeObject.width() * 0.8, sizeObject.height() * 0.8)

        self.setWindowFlags(self.windowFlags()
                            | QtCore.Qt.WindowMinimizeButtonHint
                            | QtCore.Qt.WindowMaximizeButtonHint)

        self.top_layout = QtWidgets.QVBoxLayout()
        # self.top_layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(self.top_layout)

        self.toolbar_lay = QtWidgets.QHBoxLayout()
        self.top_layout.addLayout(self.toolbar_lay)

        self.openBtn = QtWidgets.QPushButton("Open...", )
        self.openBtn.setShortcut('Ctrl+o')
        self.openBtn.clicked.connect(self.manualOpen)
        self.toolbar_lay.addWidget(self.openBtn)

        self.reloadBtn = QtWidgets.QPushButton("Reload")
        self.reloadBtn.setShortcut('Ctrl+r')
        self.reloadBtn.clicked.connect(self.load_file)
        self.toolbar_lay.addWidget(self.reloadBtn)

        self.loadTextChk = QtWidgets.QCheckBox("Load Textures")
        self.loadTextChk.setChecked(self.walk_attributes)
        self.loadTextChk.stateChanged.connect(self.loadTextChkChanged)
        self.toolbar_lay.addWidget(self.loadTextChk)

        self.findBtn = QtWidgets.QPushButton("Find...")
        self.findBtn.setShortcut('Ctrl+f')
        self.findBtn.clicked.connect(self.findWindow)
        self.toolbar_lay.addWidget(self.findBtn)

        self.layoutBtn = QtWidgets.QPushButton("Layout Nodes")
        self.layoutBtn.clicked.connect(self.layout_nodes)
        self.toolbar_lay.addWidget(self.layoutBtn)

        toolbarspacer = QtWidgets.QSpacerItem(10, 10,
                                              QtWidgets.QSizePolicy.Expanding,
                                              QtWidgets.QSizePolicy.Minimum)
        self.toolbar_lay.addItem(toolbarspacer)

        splitter = QtWidgets.QSplitter()

        self.top_layout.addWidget(splitter)

        main_widget = QtWidgets.QWidget()
        main_widget.setContentsMargins(0, 0, 0, 0)

        splitter.addWidget(main_widget)
        lay = QtWidgets.QVBoxLayout()
        lay.setContentsMargins(0, 0, 0, 0)

        main_widget.setLayout(lay)

        self.top_layout.addLayout(lay)

        logger.info('building nodes')
        configPath = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                                  'nodz_config.json')

        self.nodz = nodz_main.Nodz(self, configPath=configPath)
        self.nodz.editLevel = 1
        # self.nodz.editEnabled = False
        lay.addWidget(self.nodz)
        self.nodz.initialize()
        self.nodz.fitInView(-500, -500, 500, 500)

        info_scroll = QtWidgets.QScrollArea()
        info_scroll.setWidgetResizable(True)
        self.info_panel = info_panel.InfoPanel(parent=self)
        info_scroll.setWidget(self.info_panel)
        splitter.addWidget(info_scroll)

        splitter.setSizes([self.width() * 0.8, self.width() * 0.2])

        self.nodz.signal_NodeMoved.connect(self.on_nodeMoved)
        self.nodz.signal_NodeSelected.connect(self.on_nodeSelected)
        self.nodz.signal_NodeContextMenuEvent.connect(self.node_context_menu)
        self.nodz.signal_KeyPressed.connect(self.pickwalk)
Esempio n. 9
0
 def center(self): #The center method
     
     panelgeo = self.frameGeometry() #We get a rectangle specifying the geometry of the main window. This includes any window frame. 
     monitorcenter = QtWidgets.QDesktopWidget().availableGeometry().center() #We figure out the screen resolution of our monitor. And from this resolution, we get the center point. 
     panelgeo.moveCenter(monitorcenter) #Our rectangle has already its width and height. Now we set the center of the rectangle to the center of the screen. The rectangle's size is unchanged. 
     self.move(panelgeo.topLeft()) #We move the top-left point of the application window to the top-left point of the qr rectangle, thus centering the window on our screen.     
Esempio n. 10
0
    def __init__(self, ui_file):
        super(SoftwareManagerGUI, self).__init__()
        # parent custom widget
        RenderAwesomeUI(ui_file=ui_file, parent_widget=self, css_file=CSS_FILE)
        # init attribute
        self.offset = None
        self.app_launchers = htk.get_launchers()
        self.resources = HZResources()
        self.user_name = env.USERNAME.string
        self.local_profile_folder = get_local_profile_dir()
        self.drag_file = ''
        self.wrappers_dir = WRAPPERS
        self.app_dir = APP_DIR
        self.icon_combo_box = QtWidgets.QComboBox()
        self.user_image = htk.pathjoin(self.local_profile_folder, "user.png")
        self.delete = False
        self.gui_show = True
        self.drag_pos = QtCore.QPoint(0, 0)
        self.right_button = False
        self.background_image = None
        _image = om.read(self.local_profile_folder, 'skin')

        # init windows
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.Window
                            | QtCore.Qt.WindowStaysOnTopHint
                            | QtCore.Qt.WindowSoftkeysRespondHint)
        self.comboBox_project_list.addItems(self.get_project_list())

        self.set_current_project()

        self.icon_combo_box.addItem(self.icon("default_software_icon.png"),
                                    "Dmyz")
        self.quit_action = QtWidgets.QAction(
            "exit", self, triggered=QtWidgets.QApplication.quit)
        open_log_action = QtWidgets.QAction("Explore Log Folder ",
                                            self,
                                            triggered=self.go_to_log_folder)

        self.open_local_folder = QtWidgets.QAction(
            "Open Local Settings Folder",
            self,
            triggered=self.explore_local_settings_folder)
        project_manager_action = QtWidgets.QAction(
            "project manager", self, triggered=self.go_to_log_folder)

        self.tray_icon_menu = QtWidgets.QMenu(self)
        if _image:
            self.background_image = _image.encode("utf-8").replace("\\", "/")

        self.skin_action = QtWidgets.QAction('Skin Store',
                                             self,
                                             triggered=self.show_skin_widget)

        self.change_css = QtWidgets.QMenu('Change CSS', self.tray_icon_menu)

        default = QtWidgets.QAction("default",
                                    self.change_css,
                                    triggered=self.change_css_default)

        self.change_css.addAction(default)

        self.tray_icon_menu.addAction(self.skin_action)

        self.tray_icon_menu.addAction(self.open_local_folder)

        self.tray_icon_menu.addAction(project_manager_action)

        self.tray_icon_menu.addAction(open_log_action)

        random_skin_aciton = self._action("random_skin", self._skin_timer)
        random_skin_aciton.setCheckable(True)
        status = om.read(self.local_profile_folder, "random_skin")
        if status:
            random_skin_aciton.setChecked(status)

        self.tray_icon_menu.addAction(random_skin_aciton)

        self.tray_icon_menu.addMenu(self.change_css)
        self.tray_icon_menu.addAction(self.quit_action)
        gif_file = HZResources.get_icon_resources("default_software_icon.gif")
        self.tray_icon = AnimatedSystemTrayIcon(QtGui.QMovie(gif_file), self)
        self.tray_icon.setContextMenu(self.tray_icon_menu)
        self.icon_combo_box.currentIndexChanged.connect(self.set_icon)
        self.setWindowIcon(self.icon("default_software_icon.png"))
        self.icon_combo_box.setCurrentIndex(1)
        self.tray_icon.show()
        self.tray_icon.setToolTip('HZ')
        self.tray_icon.activated.connect(self.icon_activated)
        self.setAcceptDrops(True)
        self.set_transparency(True)

        if os.path.isfile(self.user_image):
            self.user_button.setIcon(
                self.create_round_thumbnail(self.user_image))
        else:
            self.user_button.setIcon(
                self.create_round_thumbnail(
                    self.icon("default_user_thumb.png", True)))

        self.pushButton_bottom_icon.setIcon(self.icon("software_name.png"))
        self.pushButton_top_icon.setIcon(self.icon("hz_label.png"))
        self.pushButton_hide.setIcon(self.icon("software_manager_hide.png"))
        self.pushButton_close.setIcon(self.icon("software_manager_close.png"))
        self.pushButton_hide.clicked.connect(self.close)
        self.pushButton_close.clicked.connect(QtWidgets.QApplication.quit)
        self.tool_box = QtWidgets.QToolBox()
        self.software_commands = QtWidgets.QListWidget(self)
        self.software_commands.itemDoubleClicked.connect(self.launch)
        self.software_commands.setContextMenuPolicy(
            QtCore.Qt.ActionsContextMenu)
        self.verticalLayout_3.addWidget(self.software_commands)
        self.search_text.textChanged.connect(self.search_software)
        self.pushButton_bottom_icon.clicked.connect(self.popup_web)

        self.user_menu = QtWidgets.QMenu(self)

        self.user_menu.addSeparator()

        user_action = QtWidgets.QAction("change user image",
                                        self,
                                        triggered=self.set_user_image)

        self.user_menu.addAction(user_action)

        self.user_button.setMenu(self.user_menu)

        self.desktop = QtWidgets.QDesktopWidget()

        self.move(self.desktop.availableGeometry().width() - self.width(),
                  self.desktop.availableGeometry().height() - self.height())

        self.save_current_project()
        self.set_items()
        self.comboBox_project_list.activated.connect(self.set_items)
        self.update_info_file = htk.pathjoin(self.resources.resources_root,
                                             'update.txt')
        self.file_watcher = QtCore.QFileSystemWatcher([self.update_info_file])
        self.file_watcher.fileChanged.connect(self.on_file_changed)
        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.time_task)
        self.timer.start(1000)
        if self.background_image:
            self.set_background_image_css(
                self.background_image.decode("utf-8"))
        else:
            self.set_background_image_css(self.get_skin())
        self.skin_timer = QtCore.QTimer(self)
        self.skin_timer.timeout.connect(self.random_skin)
        if status:
            self.skin_timer.start(20000)