Exemplo n.º 1
0
    def __init__(self, config_dir=None, parent=None):
        super(QWatson, self).__init__(parent)
        self.setWindowIcon(icons.get_icon('master'))
        self.setWindowTitle(__namever__)
        self.setMinimumWidth(300)
        self.setWindowFlags(Qt.Window | Qt.WindowMinimizeButtonHint
                            | Qt.WindowCloseButtonHint)

        if platform.system() == 'Windows':
            import ctypes
            myappid = __namever__
            ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(
                myappid)

        config_dir = (config_dir or os.environ.get('QWATSON_DIR')
                      or click.get_app_dir('QWatson'))

        self.client = Watson(config_dir=config_dir)
        self.model = WatsonTableModel(self.client)

        self.setup_activity_overview()
        self.setup()

        if self.client.is_started:
            self.add_new_project(self.client.current['project'])
            self.stop_watson(tags=['error'],
                             message="last session not closed correctly.")
        self.set_settings_from_index(-1)
Exemplo n.º 2
0
    def setup(self):
        """Setup the dialog widgets and layout."""

        # Add buttons to the dialog

        self.add_dialog_button(QPushButton('Import'), 'Import', True)
        self.add_dialog_button(QPushButton('Cancel'), 'Cancel')

        # Setup the info box

        url_i = "https://github.com/jnsebgosselin/qwatson#installation"
        info_text = (
            "<b>Do you want to import Watson's settings and data?</b><br><br>"
            "For compatibility reasons, QWatson uses separate settings"
            " and data from Watson."
            " See the <a href=\"%s\">documentation</a> for more details."
        ) % url_i

        info_box = InfoBox(info_text, icon=icons.get_icon('master'))
        info_box.setContentsMargins(10, 10, 10, 10)

        # Setup the layout of the dialog

        layout = QVBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)

        layout.addWidget(info_box)
        layout.addWidget(self.button_box)
        layout.setStretch(0, 100)
Exemplo n.º 3
0
 def __init__(self, icon=None, iconsize='normal', parent=None):
     super(QToolButtonBase, self).__init__(parent)
     self.setAutoRaise(True)
     self.setFocusPolicy(Qt.NoFocus)
     if icon is not None:
         self.setIcon(
             icons.get_icon(icon) if isinstance(icon, str) else icon)
         self.setIconSize(
             icons.get_iconsize(iconsize) if isinstance(iconsize, str
                                                        ) else iconsize)
Exemplo n.º 4
0
    def paint(self, painter, option, index):
        """Paint a toolbutton with an icon."""
        super(ToolButtonDelegate, self).paint(painter, option, index)

        opt = QStyleOptionToolButton()
        opt.rect = self.get_btn_rect(option)
        opt.iconSize = icons.get_iconsize('small')
        opt.state |= QStyle.State_Enabled | QStyle.State_Raised
        opt.icon = icons.get_icon('erase-right')

        QApplication.style().drawControl(QStyle.CE_ToolButtonLabel, opt,
                                         painter)
Exemplo n.º 5
0
    def __init__(self, model, parent=None):
        super(ActivityOverviewWidget, self).__init__(parent)
        self.setWindowIcon(icons.get_icon('master'))
        self.setWindowTitle("Activity Overview")

        self.model = model
        self.model.sig_btn_delrow_clicked.connect(self.del_activity)

        self.setup(model)
        self.filter_btn.tags_menu.setup_menu_items()
        self.filter_btn.projects_menu.setup_menu_items()
        self.date_span_changed()
Exemplo n.º 6
0
 def __init__(self, icon, icon_raised=None, size='normal', parent=None):
     self._icon = icons.get_icon(icon) if isinstance(icon, str) else icon
     self._icon_raised = (icons.get_icon(icon_raised) if isinstance(
         icon_raised, str) else icon_raised)
     super(OnOffToolButton, self).__init__(self._icon, size, parent)
     self.installEventFilter(self)