示例#1
0
 def __init__(self, parent=None):
     super(TabbedTerminal, self).__init__(parent)
     self.setTabPosition(QtWidgets.QTabWidget.South)
     
     # Corner widget
     self.buttonNew = QtWidgets.QPushButton(self)
     self.buttonNew.setText("")
     self.buttonNew.setIcon(QtGui.QIcon.fromTheme("tab-new"))
     self.buttonNew.setMaximumSize(QtCore.QSize(28, 28))
     self.buttonNew.clicked.connect(lambda checked: self.newTerminal())
     self.setCornerWidget(self.buttonNew)
     
     self.setTabsClosable(True)
     self.setMovable(True)
     self.tabCloseRequested[int].connect(self._on_close_request)
     self.currentChanged[int].connect(self._on_current_changed)
     
     # Color scheme
     self.__colorScheme = ColorScheme.scheme("default")
示例#2
0
 def setColorScheme(self, schemeName):
     self.__colorScheme = ColorScheme.scheme(schemeName) if isinstance(schemeName, six.string_types) else schemeName
     for index in range(self.count()):
         self.widget(index).setColorScheme(self.__colorScheme)
示例#3
0
 def on_defaultTheme_changed(self, themeUUID):
     theme = self.application().supportManager.getBundleItem(themeUUID)
     scheme = ColorScheme(theme.name)
     
     styles = theme.style()
     # Foreground and background
     scheme.setBackground(styles["background"])
     scheme.setBackground(styles["selection"], intense = True)
     scheme.setForeground(styles["foreground"])
     scheme.setForeground(styles["lineHighlight"], intense = True)
     
     # Mapping scopes :)
     scopes = SHEME_SCOPES[:]
     random.shuffle(scopes)
     scopes = scopes[:16]
     for index, scope in enumerate(scopes[:8]):
         scheme.setColor(index, theme.style(scope)["foreground"])
     for index, scope in enumerate(scopes[8:]):
         scheme.setColor(index, theme.style(scope)["foreground"], intense = True)
     
     self.tabTerminals.setColorScheme(scheme)
示例#4
0
from prymatex.core import PrymatexDock
from prymatex.core.settings import ConfigurableItem
from prymatex.utils.i18n import ugettext as _
from prymatex.utils import six

from prymatex.widgets.pmxterm import Backend, BackendManager, TerminalWidget, ColorScheme

SHEME_SCOPES = [ 'comment', 'string', 'constant.numeric', 'constantanguage', 
    'constant.character, constant.other', 'variable.language, variable.other',
    'keyword', 'storage', 'entity.name.class', 'entity.other.inherited-class',
    'entity.name.function', 'variable.parameter', 'entity.name.tag',
    'entity.other.attribute-name', 'support.function', 'support.constant',
    'support.type, support.class', 'support.other.variable', 'invalid' ]

# Load color schemes
ColorScheme.loadSchemes(os.path.join(config.PMX_SHARE_PATH, "TerminalSchemes"))

class TabbedTerminal(QtWidgets.QTabWidget):
    def __init__(self, parent=None):
        super(TabbedTerminal, self).__init__(parent)
        self.setTabPosition(QtWidgets.QTabWidget.South)
        
        # Corner widget
        self.buttonNew = QtWidgets.QPushButton(self)
        self.buttonNew.setText("")
        self.buttonNew.setIcon(QtGui.QIcon.fromTheme("tab-new"))
        self.buttonNew.setMaximumSize(QtCore.QSize(28, 28))
        self.buttonNew.clicked.connect(lambda checked: self.newTerminal())
        self.setCornerWidget(self.buttonNew)
        
        self.setTabsClosable(True)