Python PyQt5.QtGui.QIcon() Examples

The following are code examples for showing how to use PyQt5.QtGui.QIcon(). They are from open source Python projects. You can vote up the examples you like or vote down the ones you don't like.

Example 1
Project: NordVPN-NetworkManager-Gui   Author: vfosterm   File: nord_nm_gui.py    GNU General Public License v3.0 6 votes vote down vote up
def __init__(self):
        """
        Initialize Global Variables and login GUI
        Declare directories and paths
        """
        super(MainWindow, self).__init__()
        self.setObjectName("MainWindowObject")
        self.setWindowIcon(QtGui.QIcon('nordvpnicon.png'))
        self.base_dir = os.path.join(os.path.abspath(os.path.expanduser('~')), '.nordnmconfigs')  # /home/username/.nordnmconfigs
        self.config_path = os.path.join(os.path.abspath(self.base_dir), '.configs')
        self.scripts_path = os.path.join(os.path.abspath(self.base_dir), '.scripts')
        self.network_manager_path = '/etc/NetworkManager/dispatcher.d/'
        self.conf_path = os.path.join(self.config_path, 'nord_settings.conf')
        self.config = configparser.ConfigParser()
        self.api_data = self.get_api_data()
        self.username = None
        self.password = None
        self.sudo_password = None
        self.connection_name = None
        self.connected_server = None
        self.domain_list = []
        self.server_info_list = []
        self.login_ui()
        self.show() 
Example 2
Project: ANGRYsearch   Author: DoTheEvo   File: angrysearch.py    GNU General Public License v2.0 6 votes vote down vote up
def get_tray_icon(self):
        base64_data = '''iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABHN
                         CSVQICAgIfAhkiAAAAQNJREFUOI3t1M9KAlEcxfHPmP0xU6Ogo
                         G0teoCiHjAIfIOIepvKRUE9R0G0KNApfy0c8hqKKUMrD9zVGc4
                         9nPtlsgp5n6qSVSk7cBG8CJ6sEX63UEcXz4jE20YNPbygPy25Q
                         o6oE+fEPXFF7A5yA9Eg2sQDcU3sJd6k89O4iiMcYKVol3rH2Mc
                         a1meZ4hMdNPCIj+SjHHfFZU94/0Nwlv4rWoY7vhrdeLNoO86bG
                         lym/ge3lsHDdI2fojbBG6sUtzOiQ1wQOwk6GwWKHeJyHtxOcFi
                         0TpFaxmnhNcyIW45bQ6RS3Hq4MeB7Ltyahki9Gd2xidWiwG9va
                         nCZqi7xlZGVHfwN6+5nU/ccBUYAAAAASUVORK5CYII='''

        pm = Qg.QPixmap()
        pm.loadFromData(base64.b64decode(base64_data))
        i = Qg.QIcon()
        i.addPixmap(pm)
        return i

    # OFF BY DEFAULT
    # 0.2 SEC DELAY TO LET USER FINISH TYPING BEFORE INPUT BECOMES A DB QUERY 
Example 3
Project: ANGRYsearch   Author: DoTheEvo   File: angrysearch.py    GNU General Public License v2.0 6 votes vote down vote up
def get_mime_icons(self):
        file_icon = self.style().standardIcon(Qw.QStyle.SP_FileIcon)
        icon_dic = {'folder': self.style().standardIcon(Qw.QStyle.SP_DirIcon),
                    'file': file_icon,
                    'image': file_icon,
                    'audio': file_icon,
                    'video': file_icon,
                    'text': file_icon,
                    'pdf': file_icon,
                    'archive': file_icon}

        # QT RESOURCE FILE WITH MIME ICONS AND DARK GUI THEME ICONS
        # IF NOT AVAILABLE ONLY 2 ICONS REPRESENTING FILE & DIRECTORY ARE USED
        try:
            import resource_file
            for key in icon_dic:
                icon = ':/mimeicons/{}/{}.png'.format(
                    self.setting_params['icon_theme'],
                    key)
                icon_dic[key] = Qg.QIcon(icon)
        except ImportError:
            pass

        return icon_dic 
Example 4
Project: synspy   Author: informatics-isi-edu   File: __main__.py    BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def main():
    sys.excepthook = excepthook

    QApplication.setDesktopSettingsAware(False)
    QApplication.setStyle(QStyleFactory.create("Fusion"))
    app = QApplication(sys.argv)
    app.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps)
    app.setWindowIcon(QIcon(":/images/synapse.png"))
    cli = BaseCLI("Synapse Viewer Launcher",
                  "For more information see: https://github.com/informatics-isi-edu/synspy", synspy_version)
    cli.remove_options(["--credential-file"])
    args = cli.parse_cli()
    mainWindow = mw.MainWindow(args.config_file)
    mainWindow.show()
    ret = app.exec_()
    return ret 
Example 5
Project: Pesterchum   Author: henry232323   File: dialogs.py    MIT License 6 votes vote down vote up
def add_user(self, user):
        '''
        Add a user & PrivateMessageWidget to window, check if it is already there
        if so, return that user's PM, if not, create and return a PM
        On PrivateMessageWidget creation, send a PESTERCHUM:BEGIN initiation message
        '''
        if not user in self.users:
            windw = PrivateMessageWidget(self.app, self.tabWidget, self, user)
            if user != "nickServ":
                self.app.send_begin(user)
            icon = QIcon("resources/pc_chummy.png")
            a = self.tabWidget.addTab(windw, icon, user)
            tab = self.tabWidget.widget(a)
            self.users.append(user)
            return tab
        else:
            return self.tabWidget.widget(self.users.index(user)) 
Example 6
Project: Pesterchum   Author: henry232323   File: dialogs.py    MIT License 6 votes vote down vote up
def __init__(self, app, parent):
        super(__class__, self).__init__()
        uic.loadUi(app.theme["ui_path"] + "/UserlistWindow.ui", self)
        self.app = app
        self.parent = parent
        self.closeUserlist.clicked.connect(self.close)
        self.setWindowTitle('Userlist')
        self.setWindowIcon(QIcon("resources/pc_chummy.png"))

        width = self.frameGeometry().width()
        height = self.frameGeometry().height()
        self.setFixedSize(width, height)

        self.userList.setSortingEnabled(True)
        self.userList.addItems(self.app.names_list["#pesterchum"])
        self.userList.itemDoubleClicked.connect(self.app.gui.open_privmsg_userlist)

        self.show() 
Example 7
Project: Pesterchum   Author: henry232323   File: dialogs.py    MIT License 6 votes vote down vote up
def __init__(self, app, parent):
        super(__class__, self).__init__()
        uic.loadUi(app.theme["ui_path"] + "/MemoWindow.ui", self)
        self.app = app
        self.parent = parent
        self.setWindowTitle('Memos')
        self.setWindowIcon(QIcon("resources/pc_chummy.png"))
        width = self.frameGeometry().width()
        height = self.frameGeometry().height()
        self.setFixedSize(width, height)
        self.memosTableWidget.setColumnCount(2)
        self.memosTableWidget.setHorizontalHeaderLabels(["Memo", "Users"])
        self.memosTableWidget.doubleClicked.connect(self.openMemo)
        header = self.memosTableWidget.horizontalHeader()
        header.setSectionResizeMode(QHeaderView.Stretch)
        self.ctr = 0
        self.app.send_list()

        self.show() 
Example 8
Project: Pesterchum   Author: henry232323   File: dialogs.py    MIT License 6 votes vote down vote up
def __init__(self, app, parent, memo):
        '''
        A window for storing PrivateMessageWidget instances, a navigation
        between current private message users
        '''
        super(__class__, self).__init__()
        self.parent = parent
        self.app = app
        uic.loadUi(app.theme["ui_path"] + "/MemoTabWindow.ui", self)
        self.memos = []
        self.init_memo = self.add_memo(memo)
        self.tabWidget.removeTab(0)  # Remove two default tabs
        self.tabWidget.removeTab(0)
        self.tabWidget.setTabsClosable(True)
        self.tabWidget.tabCloseRequested.connect(self.closeTab)
        self.setWindowTitle("Memos")
        self.setWindowIcon(QIcon(self.app.theme["path"] + "/memo.png"))
        self.app.gui.memoTabWindow = self
        self.show() 
Example 9
Project: Pesterchum   Author: henry232323   File: dialogs.py    MIT License 6 votes vote down vote up
def __init__(self, app):
        super(__class__, self).__init__()
        self.app = app
        uic.loadUi(self.app.theme["ui_path"] + "/QuirksWindow.ui", self)
        self.addQuirkButton.clicked.connect(self.openQuirk)
        self.editQuirkButton.clicked.connect(self.editQuirk)
        self.removeQuirkButton.clicked.connect(self.removeQuirk)
        self.cancelButton.clicked.connect(self.closeWin)
        self.okButton.clicked.connect(self.save)
        self.testButton.clicked.connect(self.testQuirks)
        for type, quirk in self.app.quirks.quirks:
            self.quirksList.addItem("{}:{}".format(type, quirk))

        self.setWindowTitle('Quirks')
        self.setWindowIcon(QIcon(app.theme["path"] + "/trayicon.png"))

        self.show() 
Example 10
Project: Dolphin-Updater   Author: nbear3   File: dolphinapp.py    GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, user_data_control):
        super().__init__()
        sys.excepthook = self._displayError
        self._udc = user_data_control

        self.check = QPixmap("res/check.png")
        self.cancel = QPixmap("res/cancel.png")

        self.setGeometry(500, 500, 500, 465)
        self.init_ui()
        self.init_window()
        self.init_user_data()

        self.setWindowTitle(self.APP_TITLE)
        self.setWindowIcon(QIcon('res/rabbit.png'))
        center(self)
        self.show()

    # PyQt Error Handling 
Example 11
Project: straditize   Author: Chilipp   File: progress_widget.py    GNU General Public License v3.0 6 votes vote down vote up
def refresh(self):
        pw = self.progress_widget
        state = self.state
        icon = icons[state]
        visible = pw.visible_tasks in ['all', state]
        self.setIcon(QtGui.QIcon(icon))
        self.setHidden(not visible)
        if self.done:
            try:
                tt = self.done_tooltip
            except Exception:
                tt = ''
            if tt is None:
                tt = self.task_tooltip
        else:
            tt = self.task_tooltip
        self.setToolTip(tt) 
Example 12
Project: pytentiostat   Author: juami   File: GUI_run_exp.py    BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def set_icon(ui):
    """
    Initialize all the icon state to be unchecked

    Parameters
    -------
    ui : the Ui_Experiment object
        Instance is created in the main.py

    """
    for index in range(ui.experiment_queue.count()):
        item = ui.experiment_queue.item(index)
        filename = item.data(3)

        if 'CA' in filename:
            icon = QIcon("../pics/icon_ca.ico")
        elif 'CV' in filename:
            icon = QIcon("../pics/icon_cv.ico")
        elif 'LSV' in filename:
            icon = QIcon("../pics/icon_lsv.ico")
        if icon:
            item.setData(1, icon)
        itemtext = filename.split('/')[-1].strip() + '__#'+ str(index+1)
        item.setData(2,itemtext) 
Example 13
Project: pyaudiorestoration   Author: HENDRIX-ZT2   File: widgets.py    GNU General Public License v2.0 6 votes vote down vote up
def __init__(self, name, object_widget, canvas_widget, count):
		QtWidgets.QMainWindow.__init__(self)		
		
		self.name = name
		self.resize(720, 400)
		self.setWindowTitle(name)
		try:
			base_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
			self.setWindowIcon(QtGui.QIcon(os.path.join(base_dir,'icons/'+name+'.png')))
		except: pass
		
		self.cfg = config.read_config("config.ini")
		
		self.props = object_widget(parent=self, count=count)
		self.canvas = canvas_widget(parent=self)
		self.canvas.props = self.props
		self.props.file_widget.on_load_file = self.canvas.load_audio

		splitter = QtWidgets.QSplitter(QtCore.Qt.Horizontal)
		splitter.addWidget(self.canvas.native)
		splitter.addWidget(self.props)
		self.setCentralWidget(splitter) 
Example 14
Project: SqlToExcel   Author: xugongli   File: mainwindow.py    MIT License 6 votes vote down vote up
def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "mysql导出工具_BY_夜雨微寒"))
        self.setWindowIcon(QtGui.QIcon(r'F:\my_PythonClass_to_exe\file.ico'))
        self.iPLabel.setText(_translate("MainWindow", "主机名或IP"))
        self.iPLineEdit.setText(_translate("MainWindow", "localhost"))
        self.usernameLabel.setText(_translate("MainWindow", "username"))
        self.usernameLineEdit.setText(_translate("MainWindow", "test"))
        self.passwdLabel.setText(_translate("MainWindow", "passwd"))
        self.passwdLineEdit.setText(_translate("MainWindow", "123456"))
        self.databaseLabel.setText(_translate("MainWindow", "database"))
        self.databaseLineEdit.setText(_translate("MainWindow", "crawl_data"))
        self.sql_wordLabel.setText(_translate("MainWindow", "sql_word"))
        self.sql_wordLineEdit.setText(_translate("MainWindow", r"sql查询语句,例如:SELECT * from china_village "))
        self.Label.setText(_translate("MainWindow", "文件名"))
        self.explort_filepath_LineEdit.setText(_translate("MainWindow", "输入文件名(可选,不要带扩展名)"))
        self.pushButton_csv.setText(_translate("MainWindow", "导出为CSV"))
        self.pushButton_reset.setText(_translate("MainWindow", "清空并重置"))
        self.pushButton_excel.setText(_translate("MainWindow", "导出为Excel")) 
Example 15
Project: SCGV   Author: KrasnitzLab   File: main_window.py    MIT License 6 votes vote down vote up
def __init__(self, window):
        self.window = window

        self.window.toolbar.addSeparator()
        icons = icons_folder()

        self.open_dir_action = QAction(
            QIcon(os.path.join(icons, "folder.png")),
            "Open Directory", self.window)
        self.open_dir_action.setStatusTip("Open Directory button")
        self.open_dir_action.triggered.connect(self.on_open_directory_click)
        self.window.toolbar.addAction(self.open_dir_action)

        self.open_archive_action = QAction(
            QIcon(os.path.join(icons, "archive.png")),
            "Open Archive", self.window)
        self.open_archive_action.setStatusTip("Open Archive button")
        self.open_archive_action.triggered.connect(self.on_open_archive_click)
        self.window.toolbar.addAction(self.open_archive_action)

        self.threadpool = QThreadPool() 
Example 16
Project: SCGV   Author: KrasnitzLab   File: main_window.py    MIT License 6 votes vote down vote up
def __init__(self, window):
        self.window = window
        self.model = None

        self.window.toolbar.addSeparator()
        # icons = icons_folder()

        self.feature_view_action = QAction(
            # QIcon(os.path.join(icons, "format-justify-fill.png")),
            "Feature View", self.window
        )
        self.feature_view_action.setStatusTip("Open Feature View")
        self.feature_view_action.triggered.connect(
            self.on_feature_view_action)
        self.window.toolbar.addAction(self.feature_view_action)

        self.configure_tracks_action = QAction(
            "Configure Tracks", self.window
        )
        self.configure_tracks_action.setStatusTip("Configure Tracks")
        self.configure_tracks_action.triggered.connect(
            self.on_configure_tracks_action_action)
        self.window.toolbar.addAction(self.configure_tracks_action) 
Example 17
Project: mega.syno   Author: john-shine   File: tray.py    GNU General Public License v3.0 6 votes vote down vote up
def initUI(self): 
        width = QDesktopWidget().screenGeometry(-1).width()

        self.setWindowTitle('system tray')
        self.setWindowFlags(Qt.CustomizeWindowHint)
        self.setWindowFlags(Qt.FramelessWindowHint)
        self.setWindowFlag(Qt.WindowCloseButtonHint, False)
        self.setWindowFlag(Qt.WindowMinimizeButtonHint, False)     
        
        self.button = QPushButton('', self)
        self.button.setGeometry(QRect(width - self.icon_size - 1, 0, self.icon_size, self.icon_size))
        ico = QtGui.QPixmap(':/mega.ico')
        self.button.setIcon(QtGui.QIcon(ico))
        self.button.clicked.connect(self.launch_mega)
        
        self.setGeometry(0, 0, width, self.icon_size)
        self.setFixedSize(self.width(), self.height())

        self.show() 
Example 18
Project: Lector   Author: BasioMeusPuga   File: pie_chart.py    GNU General Public License v3.0 6 votes vote down vote up
def pixmapper(position_percent, temp_dir, consider_read_at, size):
    # A current_chapter of -1 implies the files does not exist
    # position_percent and consider_read_at are expected as a <1 decimal value

    return_pixmap = None
    consider_read_at = consider_read_at / 100

    if position_percent == -1:
        return_pixmap = QtGui.QIcon(':/images/error.svg').pixmap(size)
        return return_pixmap

    if position_percent >= consider_read_at:  # Consider book read @ this progress
        return_pixmap = QtGui.QIcon(':/images/checkmark.svg').pixmap(size)
    else:

        # TODO
        # See if saving the svg to disk can be avoided
        # Maybe make the alignment a little more uniform across emblems

        generate_pie(int(position_percent * 100), temp_dir)
        svg_path = os.path.join(temp_dir, 'lector_progress.svg')
        return_pixmap = QtGui.QIcon(svg_path).pixmap(size - 4)  ## The -4 looks more proportional

    return return_pixmap 
Example 19
Project: Physics_Project   Author: QuandisS   File: test2.py    Apache License 2.0 5 votes vote down vote up
def initUI(self):

        exitAction = QAction(QIcon('exit24.png'), 'Exit', self)
        exitAction.setShortcut('Ctrl+Q')
        exitAction.triggered.connect(qApp.quit)

        self.toolbar = self.addToolBar('Exit')
        self.toolbar.addAction(exitAction)

        self.setGeometry(300, 300, 300, 200)
        self.setWindowTitle('Toolbar')
        self.show() 
Example 20
Project: bigquerylayers   Author: smandaric   File: test_resources.py    GNU General Public License v3.0 5 votes vote down vote up
def test_icon_png(self):
        """Test we can click OK."""
        path = ':/plugins/BigQueryLayers/icon.png'
        icon = QIcon(path)
        self.assertFalse(icon.isNull()) 
Example 21
Project: Adfly-Bot   Author: vkpdeveloper   File: main.py    MIT License 5 votes vote down vote up
def initWindow(self):
        self.setWindowTitle(self.title)
        self.setGeometry(self.top, self.left, self.width, self.height)
        self.setWindowIcon(QIcon(self.iconName))
        self.setStyleSheet("background:white")
        # self.setAutoFillBackground(True)
        # p = self.palette()
        # p.setColor(self.backgroundRole(), Qt.white)
        # self.setPalette(p)
        App.setMinimumSize(self, QSize(400, 400))
        App.setMaximumSize(self, QSize(400, 400))
        self.uiComponet()
        self.show() 
Example 22
Project: synspy   Author: informatics-isi-edu   File: main_window.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def __init__(self, parent):
        super(OptionsDialog, self).__init__(parent)
        self.refreshWorklist = False
        self.setWindowTitle("Options")
        self.setWindowIcon(QIcon(":/images/synapse.png"))
        self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)
        self.setMinimumWidth(400)
        self.resize(400, 100)
        layout = QVBoxLayout(self)

        self.horizontalLayout = QHBoxLayout()
        self.pathLabel = QLabel("Downloads:")
        self.horizontalLayout.addWidget(self.pathLabel)
        self.pathTextBox = QLineEdit()
        self.pathTextBox.setReadOnly(True)
        self.cache_path = os.path.expanduser(os.path.normpath(parent.config.get("cache_dir", ".")))
        self.pathTextBox.setText(os.path.normpath(self.cache_path))
        self.horizontalLayout.addWidget(self.pathTextBox)
        self.browseButton = QPushButton("Browse", parent)
        self.browseButton.clicked.connect(self.on_actionBrowse_triggered)
        self.horizontalLayout.addWidget(self.browseButton)
        layout.addLayout(self.horizontalLayout)

        curator_mode = QCheckBox("&Curator Mode", parent)
        curator_mode.setChecked(parent.curator_mode)
        layout.addWidget(curator_mode)
        if not parent.is_curator():
            curator_mode.setEnabled(False)
        curator_mode.toggled.connect(self.onCuratorModeToggled)
        use_3D_viewer = QCheckBox("Use &3D Viewer", parent)
        use_3D_viewer.setChecked(parent.use_3D_viewer)
        layout.addWidget(use_3D_viewer)
        if platform.system() != "Linux":
            use_3D_viewer.setEnabled(False)
        use_3D_viewer.toggled.connect(self.onUse3DViewerToggled) 
Example 23
Project: ILTIS   Author: grg2rsr   File: MainWindow_Widget.py    GNU General Public License v2.0 5 votes vote down vote up
def init_UI(self):
        """ """
        # own layout
#        DesktopWidget = QtGui.QDesktopWidget()
#        qrect = DesktopWidget.screenGeometry()
#        height, width = qrect.height(), qrect.width()

#        self.resize(width*0.7,height*0.7)
#        self.move(width/15,height/15)
        self.showMaximized()

        # ini
        self.Data_Display = Data_Display_Widget(self.Main,self)
        self.Front_Control_Panel = Front_Control_Panel_Widget(self.Main,self)
        self.Container = QtWidgets.QWidget()
        self.Options_Control = Options_Control_Widget(self.Main,self)
#
#        # splitter variant
        self.Splitter = QtWidgets.QSplitter(QtCore.Qt.Horizontal)
        self.Splitter.addWidget(self.Data_Display)
        self.Splitter.addWidget(self.Front_Control_Panel)

#        self.Splitter = QtGui.QWidget(self)
        self.setCentralWidget(self.Splitter)

#        self.setWindowIcon(QtGui.QIcon(self.Main.graphics_path + os.path.sep + )) ### FIXME
        self.setWindowTitle('ILTIS')

        frac = 0.8
        self.Splitter.setSizes([int(self.Splitter.size().height() * frac), int(self.Splitter.size().height() * (1-frac))])
        # note: http://stackoverflow.com/questions/16280323/qt-set-size-of-qmainwindow

        self.show()

        pass 
Example 24
Project: idasec   Author: RobinDavid   File: MainWidget.py    GNU Lesser General Public License v2.1 5 votes vote down vote up
def __init__(self, parent):
        super(MainWidget, self).__init__()
        self.parent = parent
        self.name = "MainWidget"
        self.core = self.parent.core
        self.broker = self.core.broker
        self.icon = QtGui.QIcon("semantics.png")
        self.OnCreate(self)

    # class IDASecApp(PluginForm, Ui_Main): 
Example 25
Project: Pesterchum   Author: henry232323   File: ui_initialization.py    MIT License 5 votes vote down vote up
def initialize_buttons(self):
    self.nameButton.setIcon(QIcon(self.theme["path"] + "/chummy.png"))
    #Make color picker open on opening of the Color Button
    self.colorButton.clicked.connect(self.color_picker)
    self.mood_buttons = dict()
    #Set stylesheet and set an action for every defined mood button
    #In the dictionary, give it the corresponding Icon
    for num in range(23):
        name = "moodButton{}".format(num)
        if hasattr(self, name):
            button = getattr(self, name)
            self.mood_buttons[num] = button
            mood_name = self.app.moods.getName(num)
            button.setIcon(QIcon(os.path.join(self.theme["path"], mood_name + ".png")))
            button.clicked.connect(self.make_setMood(button)) 
Example 26
Project: Pesterchum   Author: henry232323   File: pesterchum.py    MIT License 5 votes vote down vote up
def changeUserMood(self, user, mood):
        '''Called when a friend changes their mood, sets the icon in chumsTree'''
        if type(mood) == str:
            pass
        elif type(mood) == int:
            mood = self.moods.getName(mood)
        else:
            return

        if user in self.friends.keys():
            if mood.lower() != "offline":
                self.online.add(user)
            else:
                self.online.remove(user)

            item = self.gui.getFriendItem(user)
            item.setIcon(QIcon(os.path.join(self.theme["path"], mood + ".png")))
            self.gui.friendsModel.update()

            if mood.lower() != "offline":
                index = self.gui.friendsModel.indexFromItem(item)
                a = self.gui.chumsTree.setRowHidden(index.row(),
                                                self.gui.friendsModel.parent(index),
                                                False)
            else:
                index = self.gui.friendsModel.indexFromItem(item)
                a = self.gui.chumsTree.setRowHidden(index.row(),
                                                self.gui.friendsModel.parent(index),
                                                self.options["chum_list"]["hide_offline_chums"])
            self.gui.drawTree()

        if self.gui.tabWindow:
            if user in self.gui.tabWindow.users:
                self.pm_received(fmt_mood_msg(self, mood, user), user) 
Example 27
Project: Pesterchum   Author: henry232323   File: pesterchum.py    MIT License 5 votes vote down vote up
def add_friend(self, user):
        '''Called when the ADD [CHUM] button is clicked and the dialog is answered
        Add the user to self.friends, get the users color (probably doesnt have)
        Add a new item to gui.chumsTree Widget
        Set the icon by default to'''
        self.userlist[user] = self.getColor(user)
        self.friends[user] = self.getColor(user)
        treeitem = QStandardItem(user)
        treeitem.setText(user)
        treeitem.setIcon(QIcon(self.theme["path"] + "/offline.png"))
        self.gui.friendsModel.appendRow(treeitem)
        self.gui.friendsItems[user] = treeitem
        self.getFriendMood(user) 
Example 28
Project: Pesterchum   Author: henry232323   File: dialogs.py    MIT License 5 votes vote down vote up
def __init__(self, app, parent, user):
        '''
        A window for storing PrivateMessageWidget instances, a navigation
        between current private message users
        '''
        super(__class__, self).__init__()
        self.parent = parent
        self.app = app
        uic.loadUi(app.theme["ui_path"] + "/TabWindow.ui", self)
        self.users = []
        self.init_user = self.add_user(user)
        self.tabWidget.removeTab(0)  # Remove two default tabs
        self.tabWidget.removeTab(0)
        self.tabWidget.setTabsClosable(True)
        self.tabWidget.tabCloseRequested.connect(self.closeTab)
        self.setWindowTitle("Private Message")
        self.setWindowIcon(QIcon("resources/pc_chummy.png"))
        self.show() 
Example 29
Project: Pesterchum   Author: henry232323   File: dialogs.py    MIT License 5 votes vote down vote up
def __init__(self, app, parent, user):
        '''
        Dialog opened when attempting to delete a profile
        in the switch menu
        '''
        super(__class__, self).__init__()
        self.parent = parent
        uic.loadUi(self.app.theme["ui_path"] + "/ConfirmDeleteDialog.ui", self)
        self.setWindowTitle('Confirm Delete')
        self.setWindowIcon(QIcon("resources/pc_chummy.png"))
        self.acceptButton.clicked.connect(self.accepted)
        self.rejectButton.clicked.connect(self.rejected)
        self.confirmLabel.setText("Are you sure you want to delete profile {}".format(user))
        self.exec_() 
Example 30
Project: Pesterchum   Author: henry232323   File: dialogs.py    MIT License 5 votes vote down vote up
def __init__(self, app, parent):
        '''
        Dialog opened when the Add [Chum] button is pressed, adds to chumsTree widget
        '''
        super(__class__, self).__init__()
        self.parent = parent
        self.app = app
        uic.loadUi(self.app.theme["ui_path"] + "/AddFriendDialog.ui", self)
        self.setWindowTitle('Add Chum')
        self.setWindowIcon(QIcon("resources/pc_chummy.png"))
        self.acceptButton.clicked.connect(self.accepted)
        self.rejectButton.clicked.connect(self.close)
        self.exec_() 
Example 31
Project: Pesterchum   Author: henry232323   File: dialogs.py    MIT License 5 votes vote down vote up
def __init__(self, app, parent):
        '''
        Dialog opened when the Add button is pressed in TROLLSLUM, adds to parent.blockedList widget
        '''
        super(__class__, self).__init__()
        self.parent = parent
        self.app = app
        uic.loadUi(self.app.theme["ui_path"] + "/AddBlockedDialog.ui", self)
        self.setWindowTitle('TROLLSLUM')
        self.setWindowIcon(QIcon("resources/pc_chummy.png"))
        self.acceptButton.clicked.connect(self.accepted)
        self.rejectButton.clicked.connect(self.close)
        self.exec_() 
Example 32
Project: Pesterchum   Author: henry232323   File: dialogs.py    MIT License 5 votes vote down vote up
def __init__(self, app, parent, user):
        '''
        Opened when attempting to add a friend with an invalid username
        Right now only called if the name is non-alphanumeric
        Only warns
        '''
        super(__class__, self).__init__()
        uic.loadUi(app.theme["ui_path"] + "/InvalidUserDialog.ui", self)
        self.setWindowTitle('Invalid Name')
        self.setWindowIcon(QIcon("resources/pc_chummy.png"))
        fmt = "Name <span style='font_weight: bold;'>{}</style> is not valid! Make sure it is alphanumeric"
        self.errUserLabel.setText(fmt.format(user))
        self.acceptButton.clicked.connect(self.close)
        self.exec_() 
Example 33
Project: Pesterchum   Author: henry232323   File: dialogs.py    MIT License 5 votes vote down vote up
def __init__(self, app, parent):
        super(__class__, self).__init__()
        uic.loadUi(app.theme["ui_path"] + "/BlockedDialog.ui", self)
        self.app = app
        self.parent = parent
        self.setWindowTitle('TROLLSLUM')
        self.setWindowIcon(QIcon("resources/pc_chummy.png"))
        self.addBlockButton.clicked.connect(self.add)
        self.removeBlockButton.clicked.connect(self.remove)
        for user in self.app.blocked:
            self.blockedList.addItem(QListWidgetItem(user))
        self.exec_() 
Example 34
Project: Pesterchum   Author: henry232323   File: dialogs.py    MIT License 5 votes vote down vote up
def __init__(self, app, parent):
        super(__class__, self).__init__()
        uic.loadUi(app.theme["ui_path"] + "/ConnectingDialog.ui", self)
        self.app = app
        self.parent = parent
        self.setWindowFlags(Qt.FramelessWindowHint)
        self.connectingExitButton.clicked.connect(sys.exit)
        self.setWindowTitle('Connecting')
        self.setWindowIcon(QIcon("resources/pc_chummy.png"))
        self.app.gui.connectingDialog = self
        width = self.frameGeometry().width()
        height = self.frameGeometry().height()
        self.setFixedSize(width, height)

        self.exec_() 
Example 35
Project: Pesterchum   Author: henry232323   File: dialogs.py    MIT License 5 votes vote down vote up
def add_channel(self, memo, usercount):
        self.memosTableWidget.insertRow(self.ctr)
        icn = QIcon(self.app.theme["path"] + "/memo.png")
        mitem = QTableWidgetItem(icn, memo[1:])
        mitem.setFlags(Qt.ItemFlags(Qt.ItemIsSelectable) | Qt.ItemFlags(Qt.ItemIsEnabled))
        uitem = QTableWidgetItem()
        uitem.setData(0, usercount)
        uitem.setTextAlignment(2)
        uitem.setFlags(Qt.ItemFlags(Qt.ItemIsSelectable) | Qt.ItemFlags(Qt.ItemIsEnabled))
        self.memosTableWidget.setItem(self.ctr, 0, mitem)
        self.memosTableWidget.setItem(self.ctr, 1, uitem)
        self.ctr += 1 
Example 36
Project: Pesterchum   Author: henry232323   File: dialogs.py    MIT License 5 votes vote down vote up
def add_memo(self, memo):
        '''
        Add a user & PrivateMessageWidget to window, check if it is already there
        if so, return that user's PM, if not, create and return a PM
        On PrivateMessageWidget creation, send a PESTERCHUM:BEGIN initiation message
        '''
        if not memo in self.memos:
            windw = MemoMessageWidget(self.app, self.tabWidget, self, memo)
            icon = QIcon(self.app.theme["path"] + "/memo.png")
            a = self.tabWidget.addTab(windw, icon, memo)
            tab = self.tabWidget.widget(a)
            self.memos.append(memo)
            return tab
        else:
            return self.getWidget(memo) 
Example 37
Project: dcc   Author: amimo   File: mainwindow.py    Apache License 2.0 5 votes vote down vote up
def __init__(self, parent=None, session=session_module.Session(), input_file=None, input_plugin=None):
        super(MainWindow, self).__init__(parent)
        self.session = session
        self.bin_windows = {}

        self.setupFileMenu()
        self.setupViewMenu()
        self.setupPluginsMenu()
        self.setupHelpMenu()

        self.setupCentral()
        self.setupEmptyTree()
        self.setupDock()

        self.setupSession()

        self.setWindowTitle("Androguard GUI")

        self.showStatus("Androguard GUI")

        self.installEventFilter(self)

        self.input_plugin = input_plugin

        if input_file:
            self._openFile(input_file)

        root = os.path.dirname(os.path.realpath(__file__))
        self.setWindowIcon(QtGui.QIcon(os.path.join(root, "androguard.ico"))) 
Example 38
Project: Python_Master_Courses   Author: makelove   File: pyqt5_1.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        # 设置窗口标题
        # self.setWindowTitle('My Browser')
        # 设置窗口图标
        # self.setWindowIcon(QIcon('icons/penguin.png'))
        # 设置窗口大小900*600
        # self.resize(900, 600)
        # self.show()



        # 2
        self.view = QWebEngineView()
        channel = QWebChannel()
        handler = CallHandler()
        channel.registerObject('handler', handler)
        self.view.page().setWebChannel(channel)
        self.view.loadFinished.connect(self._loadFinish)


        # 添加浏览器到窗口中
        # self.setCentralWidget(self.view)

        #
        htmlUrl = 'file:////Users/play/github/Python_Master_Courses/GUI图形界面/pyqt5/pyqt5-javascript-互相传值/js1.html'
        self.view.load(QUrl(htmlUrl))
        self.view.show()

    # 3 
Example 39
Project: raster-vision-qgis   Author: azavea   File: test_resources.py    GNU General Public License v3.0 5 votes vote down vote up
def test_icon_png(self):
        """Test we can click OK."""
        path = ':/plugins/RasterVision/icon.png'
        icon = QIcon(path)
        self.assertFalse(icon.isNull()) 
Example 40
Project: kucher   Author: Zubax   File: utils.py    GNU General Public License v3.0 5 votes vote down vote up
def get_application_icon() -> QIcon:
    return get_icon('zee') 
Example 41
Project: kucher   Author: Zubax   File: utils.py    GNU General Public License v3.0 5 votes vote down vote up
def get_icon(name: str) -> QIcon:
    return QIcon(get_icon_path(name)) 
Example 42
Project: kucher   Author: Zubax   File: tool_window_manager.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent_window: QMainWindow):
        self._parent_window: QMainWindow = parent_window

        self._children: typing.List[ToolWindow] = []
        self._menu: QMenu = None
        self._arrangement_rules: typing.List[_ArrangementRule] = []
        self._title_to_icon_mapping: typing.Dict[str, QIcon] = {}

        self._tool_window_resize_event = Event()
        self._new_tool_window_event = Event()
        self._tool_window_removed_event = Event()

        self._parent_window.tabifiedDockWidgetActivated.connect(self._reiconize)

        # Set up the appearance
        self._parent_window.setTabPosition(Qt.TopDockWidgetArea,    QTabWidget.North)
        self._parent_window.setTabPosition(Qt.BottomDockWidgetArea, QTabWidget.South)
        self._parent_window.setTabPosition(Qt.LeftDockWidgetArea,   QTabWidget.South)
        self._parent_window.setTabPosition(Qt.RightDockWidgetArea,  QTabWidget.South)

        # Now, most screens are wide but not very tall; we need to optimize the layout for that
        # More info (this is for Qt4 but works for Qt5 as well): https://doc.qt.io/archives/4.6/qt4-mainwindow.html
        self._parent_window.setCorner(Qt.TopLeftCorner,     Qt.LeftDockWidgetArea)
        self._parent_window.setCorner(Qt.BottomLeftCorner,  Qt.LeftDockWidgetArea)
        self._parent_window.setCorner(Qt.TopRightCorner,    Qt.RightDockWidgetArea)
        self._parent_window.setCorner(Qt.BottomRightCorner, Qt.RightDockWidgetArea)

        # http://doc.qt.io/qt-5/qmainwindow.html#DockOption-enum
        dock_options = self._parent_window.AnimatedDocks | self._parent_window.AllowTabbedDocks
        if not is_small_screen():
            dock_options |= self._parent_window.AllowNestedDocks    # This won't work well on small screens

        self._parent_window.setDockOptions(dock_options) 
Example 43
Project: kucher   Author: Zubax   File: port_discoverer.py    GNU General Public License v3.0 5 votes vote down vote up
def _get_port_icon(p: QtSerialPort.QSerialPortInfo) -> typing.Optional[QIcon]:
    if _get_index_of_first_matching_preferable_pattern(p) is not None:
        return get_icon('zee')
    else:
        return get_icon('question-mark') 
Example 44
Project: MovieHeavens   Author: lt94   File: movies.py    GNU General Public License v2.0 5 votes vote down vote up
def init_event(self):
        self.search_push_button.clicked.connect(self.search)
        self.search_content_text_list.itemClicked.connect(self.copy_text)

        reward_action = QAction('赞赏', self)
        reward_action.setIcon(QIcon('resources/reward.png'),)
        reward_action.triggered.connect(self.reward)

        watch_action = QAction('关注', self)
        watch_action.setIcon(QIcon('resources/watch.png'),)
        watch_action.triggered.connect(self.watch_wechat)

        reward_menu = self.menu_bar.addMenu('支持作者')
        reward_menu.addAction(reward_action)
        reward_menu.addAction(watch_action) 
Example 45
Project: rainbow6-siege-danmu-request   Author: fy-meng   File: gui.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, button_attacker_fn, button_defender_fn, font, bg_color):
        QApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
        self.app = QApplication(sys.argv)
        self.app.setWindowIcon(QIcon('icon.png'))
        ControlWindow.handle_button_attacker = button_attacker_fn
        ControlWindow.handle_button_defender = button_defender_fn
        self.display_window = DisplayWindow(font[0], font[1], font[2], bg_color)
        self.control_window = ControlWindow(font[0], font[1], font[2]) 
Example 46
Project: straditize   Author: Chilipp   File: beginner.py    GNU General Public License v3.0 5 votes vote down vote up
def icon_to_bytes(self, icon):
        buffer = QtCore.QBuffer()
        buffer.open(QtCore.QIODevice.WriteOnly)
        if isinstance(icon, str):
            icon = QtGui.QIcon(get_icon(icon))
        pixmap = icon.pixmap(10, 10)
        pixmap.save(buffer, "PNG", quality=100)
        image = bytes(buffer.data().toBase64()).decode()
        return '<img src="data:image/png;base64,{}">'.format(image) 
Example 47
Project: straditize   Author: Chilipp   File: progress_widget.py    GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, straditizer_widgets, item):
        super().__init__()
        self.init_straditizercontrol(straditizer_widgets, item)

        self.combo_display = QtWidgets.QComboBox()
        self.combo_display.setEditable(False)

        for state in [TASK_TODO, DONE, NOTYET]:
            self.combo_display.addItem(QtGui.QIcon(icons[state]), state)
        self.combo_display.addItem(ALL_TASKS)

        self.progress_list = QtWidgets.QListWidget()
        self.info_label = QtWidgets.QLabel()
        self.info_label.setWordWrap(True)
        self.info_label.setStyleSheet('border: 1px solid black')

        vbox = QtWidgets.QVBoxLayout()
        vbox.addWidget(self.combo_display)
        vbox.addWidget(self.progress_list)
        vbox.addWidget(self.info_label)
        self.setLayout(vbox)

        self.populate_list()
        self.setup_menu()
        self.refresh()
        self.combo_display.currentIndexChanged.connect(self.refresh)
        self.progress_list.itemDoubleClicked.connect(self.show_rst)
        self.progress_list.currentItemChanged.connect(self.show_rst)
        self.progress_list.currentItemChanged.connect(self.update_info_label) 
Example 48
Project: GreenLuma-Reborn-Manager   Author: ImaniiTy   File: logic.py    MIT License 5 votes vote down vote up
def setup(self):
        self.setWindowIcon(QIcon("icon.ico"))

        # Hidde Other Windows
        self.main_window.profile_create_window.setHidden(True)
        self.main_window.searching_frame.setHidden(True)
        self.main_window.set_steam_path_window.setHidden(True)
        self.main_window.closing_steam.setHidden(True)
        self.main_window.generic_popup.setHidden(True)
        self.main_window.settings_window.setHidden(True)
        #-------

        self.main_window.version_label.setText("v{0}".format(core.CURRENT_VERSION))
        self.main_window.no_hook_checkbox.setChecked(core.config.no_hook)
        self.main_window.compatibility_mode_checkbox.setChecked(core.config.compatibility_mode)
        self.populate_list(self.main_window.games_list, games)
        self.main_window.games_list.dropEvent = self.drop_event_handler
        self.populate_table(self.main_window.search_result)
        self.show_profile_names()
        self.show_profile_games(profile_manager.profiles[self.main_window.profile_selector.currentText()])
        self.setup_steam_path()
        self.setup_search_table()
        # self.main_window.main_panel.raise_()

        # Settings Window Setup
        self.main_window.update_checkbox.setChecked(core.config.check_update)

        # Shortcuts
        del_game = QShortcut(QKeySequence(Qt.Key_Delete), self.main_window.games_list)
        del_game.activated.connect(self.remove_selected) 
Example 49
Project: openeo-qgis-plugin   Author: Open-EO   File: openeo_connector.py    Apache License 2.0 5 votes vote down vote up
def run(self):
        """Run method that performs all the real work"""

        # Create the dialog with elements (after translation) and keep reference
        # Only create GUI ONCE in callback, so that it will only load when the plugin is started
        if self.first_start == True:
            self.first_start = False
            self.dlg = OpenEODialog(iface=self.iface)
            self.dlg.label_20.setPixmap(QPixmap(os.path.join(os.path.dirname(__file__), 'icon_new.png')))
            # self.dlg.infoBtn.setIcon(QIcon(os.path.join(os.path.dirname(__file__), 'info_icon.png')))
            self.dlg.infoBtn2.setIcon(QIcon(os.path.join(os.path.dirname(__file__), 'info_icon.png')))
            # self.dlg.reloadBtn.setIcon(QIcon(os.path.join(os.path.dirname(__file__), 'reload_icon.png')))
            self.dlg.refreshButton.setIcon(QIcon(os.path.join(os.path.dirname(__file__), 'reload_icon.png')))
            self.dlg.deleteButton.setIcon(QIcon(os.path.join(os.path.dirname(__file__), 'delete_job.png')))
            self.dlg.deleteFinalButton.setIcon(QIcon(os.path.join(os.path.dirname(__file__), 'deleteFinalBtn.png')))
            self.dlg.refreshButton_service.setIcon(QIcon(os.path.join(os.path.dirname(__file__), 'reload_icon.png')))
            self.dlg.deleteButton_service.setIcon(QIcon(os.path.join(os.path.dirname(__file__), 'delete_job.png')))
            self.dlg.deleteFinalButton_service.setIcon(QIcon(os.path.join(os.path.dirname(__file__), 'deleteFinalBtn.png')))
            self.dlg.operationManualBtn.setIcon(QIcon(os.path.join(os.path.dirname(__file__), 'user_manual_icon.png')))
            self.dlg.setWindowFlags(Qt.WindowStaysOnTopHint)

        # show the dialog
        self.dlg.show()
        # Run the dialog event loop
        result = self.dlg.exec_()
        # See if OK was pressed
        if result:
            # Do something useful here - delete the line containing pass and
            # substitute with your code.
            pass 
Example 50
Project: pytentiostat   Author: juami   File: GUI_routines.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def find_port_main(ui):
    """
    This function is connected with 'Find Potentiostat' button.

    Parameters
    ----------
    ui: the mainwindow object.
        Instance is created in the main.py

    Returns
    -------
    com : string, the name of the port with the potentiostat on it
          Instance is created in the main.py

    board_objects = (board, a0, a2, d9).
                   board : serial communication for board
                   a0 : location of analog read pin 0
                   a2 : location of analog read pin 2
                   d9 : location of digital pwm pin 9
                   Instance is created in the main.py

    """

    com, board, a0, a2, d9 = startup_routine(ui)
    board_objects = (board, a0, a2, d9)
    icon_true = QIcon("../pics/icon_connected.ico")
    if com and board:
        ui.arduino_connection_indicator.setIcon(icon_true)
    if not com:
        warning('Please connect potentiostat!')
    return com, board_objects