Exemplo n.º 1
0
    def __init__(self, ui):
        """
        Constructor
        
        @param ui reference to the user interface object (UI.UserInterface)
        """
        QObject.__init__(self, ui)
        self.__ui = ui
        self.__initialize()

        self.__defaults = {
            "VirtualEnvironmentPy2": "",
            "VirtualEnvironmentPy3": "",
            "UsePlainPythonPy2": False,
            "UsePlainPythonPy3": False,
            "ServerAddress": "",
            "RecentNumberApps": 10,
            "UseIPv6": False,
            "TranslationsEditor": "",
            "UseExternalBrowser": False,
            "CheckDeployMode": False,
        }
        if isWindowsPlatform():
            self.__defaults["ConsoleCommandNoClose"] = "cmd.exe /k"
            self.__defaults["ConsoleCommand"] = "cmd.exe /c"
        elif isMacPlatform():
            self.__defaults["ConsoleCommandNoClose"] = "xterm -hold -e"
            self.__defaults["ConsoleCommand"] = "xterm -e"
        else:
            self.__defaults["ConsoleCommandNoClose"] = "konsole --noclose -e"
            self.__defaults["ConsoleCommand"] = "konsole -e"

        self.__translator = None
        self.__loadTranslator()
Exemplo n.º 2
0
 def accept(self):
     """
     Public slot to accept the buttonBox accept signal.
     """
     if not isMacPlatform():
         wdg = self.focusWidget()
         if wdg == self.configList:
             return
     
     self.accepted.emit()
    def accept(self):
        """
        Public slot to accept the buttonBox accept signal.
        """
        if not isMacPlatform():
            wdg = self.focusWidget()
            if wdg == self.configList:
                return

        self.accepted.emit()
Exemplo n.º 4
0
    def __init__(self, vm):
        """
        Constructor
        
        @param vm view manager widget (Tabview)
        """
        super(TabWidget, self).__init__()

        self.__tabBar = TabBar(self)
        self.setTabBar(self.__tabBar)
        iconSize = self.__tabBar.iconSize()
        self.__tabBar.setIconSize(
            QSize(2 * iconSize.width(), iconSize.height()))

        self.setUsesScrollButtons(True)
        self.setElideMode(Qt.ElideNone)
        if isMacPlatform():
            self.setDocumentMode(True)

        self.__tabBar.tabMoveRequested.connect(self.moveTab)
        self.__tabBar.tabRelocateRequested.connect(self.__relocateTab)
        self.__tabBar.tabCopyRequested[str, int,
                                       int].connect(self.__copyTabOther)
        self.__tabBar.tabCopyRequested[int, int].connect(self.__copyTab)

        self.vm = vm
        self.editors = []

        self.indicator = E5Led(self)
        self.setCornerWidget(self.indicator, Qt.TopLeftCorner)

        self.rightCornerWidget = QWidget(self)
        self.rightCornerWidgetLayout = QHBoxLayout(self.rightCornerWidget)
        self.rightCornerWidgetLayout.setContentsMargins(0, 0, 0, 0)
        self.rightCornerWidgetLayout.setSpacing(0)

        self.__navigationMenu = QMenu(self)
        self.__navigationMenu.aboutToShow.connect(self.__showNavigationMenu)
        self.__navigationMenu.triggered.connect(self.__navigationMenuTriggered)

        self.navigationButton = QToolButton(self)

        if Preferences.getUI("SingleCloseButton") or \
           not hasattr(self, 'setTabsClosable'):
            self.closeButton = QToolButton(self)
            self.closeButton.setIcon(UI.PixmapCache.getIcon("close.png"))
            self.closeButton.setToolTip(self.tr("Close the current editor"))
            self.closeButton.setEnabled(False)
            self.closeButton.clicked[bool].connect(self.__closeButtonClicked)
            self.rightCornerWidgetLayout.addWidget(self.closeButton)
        else:
            self.tabCloseRequested.connect(self.__closeRequested)
            self.closeButton = None

        self.setCornerWidget(self.rightCornerWidget, Qt.TopRightCorner)

        self.__initMenu()
        self.contextMenuEditor = None
        self.contextMenuIndex = -1

        self.setTabContextMenuPolicy(Qt.CustomContextMenu)
        self.customTabContextMenuRequested.connect(self.__showContextMenu)

        ericPic = QPixmap(
            os.path.join(getConfig('ericPixDir'), 'pymakr_small.png'))
        self.emptyLabel = QLabel()
        self.emptyLabel.setPixmap(ericPic)
        self.emptyLabel.setAlignment(Qt.AlignVCenter | Qt.AlignHCenter)
        super(TabWidget, self).addTab(self.emptyLabel,
                                      UI.PixmapCache.getIcon("empty.png"), "")
Exemplo n.º 5
0
 def __init__(self, parent=None):
     """
     Constructor
     
     @param parent reference to the parent widget (QWidget)
     """
     super(IrcWidget, self).__init__(parent)
     self.setupUi(self)
     
     from .IrcNetworkManager import IrcNetworkManager
     self.__ircNetworkManager = IrcNetworkManager(self)
     
     self.__leaveButton = QToolButton(self)
     self.__leaveButton.setIcon(
         UI.PixmapCache.getIcon("ircCloseChannel.png"))
     self.__leaveButton.setToolTip(
         self.tr("Press to leave the current channel"))
     self.__leaveButton.clicked.connect(self.__leaveChannel)
     self.__leaveButton.setEnabled(False)
     self.channelsWidget.setCornerWidget(
         self.__leaveButton, Qt.BottomRightCorner)
     self.channelsWidget.setTabsClosable(False)
     if not isMacPlatform():
         self.channelsWidget.setTabPosition(QTabWidget.South)
     
     height = self.height()
     self.splitter.setSizes([height * 0.6, height * 0.4])
     
     self.__channelList = []
     self.__channelTypePrefixes = ""
     self.__userName = ""
     self.__identityName = ""
     self.__quitMessage = ""
     self.__nickIndex = -1
     self.__nickName = ""
     self.__server = None
     self.__registering = False
     
     self.__connectionState = IrcWidget.ServerDisconnected
     self.__sslErrorLock = False
     
     self.__buffer = ""
     self.__userPrefix = {}
     
     self.__socket = None
     if SSL_AVAILABLE:
         self.__sslErrorHandler = E5SslErrorHandler(self)
     else:
         self.__sslErrorHandler = None
     
     self.__patterns = [
         # :[email protected] PRIVMSG bar_ :some long message
         (re.compile(r":([^!]+)!([^ ]+)\sPRIVMSG\s([^ ]+)\s:(.*)"),
          self.__query),
         # :foo.bar.net COMMAND some message
         (re.compile(r""":([^ ]+)\s+([A-Z]+)\s+(.+)"""),
          self.__handleNamedMessage),
         # :foo.bar.net 123 * :info
         (re.compile(r""":([^ ]+)\s+(\d{3})\s+(.+)"""),
          self.__handleNumericMessage),
         # PING :ping message
         (re.compile(r"""PING\s+:(.*)"""), self.__ping),
     ]
     self.__prefixRe = re.compile(r""".*\sPREFIX=\((.*)\)([^ ]+).*""")
     self.__chanTypesRe = re.compile(r""".*\sCHANTYPES=([^ ]+).*""")
     
     ircPic = UI.PixmapCache.getPixmap("irc128.png")
     self.__emptyLabel = QLabel()
     self.__emptyLabel.setPixmap(ircPic)
     self.__emptyLabel.setAlignment(Qt.AlignVCenter | Qt.AlignHCenter)
     self.channelsWidget.addTab(self.__emptyLabel, "")
     
     # all initialized, do connections now
     self.__ircNetworkManager.dataChanged.connect(self.__networkDataChanged)
     self.networkWidget.initialize(self.__ircNetworkManager)
     self.networkWidget.connectNetwork.connect(self.__connectNetwork)
     self.networkWidget.editNetwork.connect(self.__editNetwork)
     self.networkWidget.joinChannel.connect(self.joinChannel)
     self.networkWidget.nickChanged.connect(self.__changeNick)
     self.networkWidget.sendData.connect(self.__send)
     self.networkWidget.away.connect(self.__away)
     self.networkWidget.autoConnected.connect(self.autoConnected)
Exemplo n.º 6
0
 def __init__(self, vm):
     """
     Constructor
     
     @param vm view manager widget (Tabview)
     """
     super(TabWidget, self).__init__()
     
     self.__tabBar = TabBar(self)
     self.setTabBar(self.__tabBar)
     iconSize = self.__tabBar.iconSize()
     self.__tabBar.setIconSize(
         QSize(2 * iconSize.width(), iconSize.height()))
     
     self.setUsesScrollButtons(True)
     self.setElideMode(Qt.ElideNone)
     if isMacPlatform():
         self.setDocumentMode(True)
     
     self.__tabBar.tabMoveRequested.connect(self.moveTab)
     self.__tabBar.tabRelocateRequested.connect(self.__relocateTab)
     self.__tabBar.tabCopyRequested[str, int, int].connect(
         self.__copyTabOther)
     self.__tabBar.tabCopyRequested[int, int].connect(self.__copyTab)
     
     self.vm = vm
     self.editors = []
     
     self.indicator = E5Led(self)
     self.setCornerWidget(self.indicator, Qt.TopLeftCorner)
     
     self.rightCornerWidget = QWidget(self)
     self.rightCornerWidgetLayout = QHBoxLayout(self.rightCornerWidget)
     self.rightCornerWidgetLayout.setContentsMargins(0, 0, 0, 0)
     self.rightCornerWidgetLayout.setSpacing(0)
     
     self.__navigationMenu = QMenu(self)
     self.__navigationMenu.aboutToShow.connect(self.__showNavigationMenu)
     self.__navigationMenu.triggered.connect(self.__navigationMenuTriggered)
     
     self.navigationButton = QToolButton(self)
     self.navigationButton.setIcon(UI.PixmapCache.getIcon("1downarrow.png"))
     self.navigationButton.setToolTip(self.tr("Show a navigation menu"))
     self.navigationButton.setPopupMode(QToolButton.InstantPopup)
     self.navigationButton.setMenu(self.__navigationMenu)
     self.navigationButton.setEnabled(False)
     self.rightCornerWidgetLayout.addWidget(self.navigationButton)
     
     if Preferences.getUI("SingleCloseButton") or \
        not hasattr(self, 'setTabsClosable'):
         self.closeButton = QToolButton(self)
         self.closeButton.setIcon(UI.PixmapCache.getIcon("close.png"))
         self.closeButton.setToolTip(
             self.tr("Close the current editor"))
         self.closeButton.setEnabled(False)
         self.closeButton.clicked[bool].connect(self.__closeButtonClicked)
         self.rightCornerWidgetLayout.addWidget(self.closeButton)
     else:
         self.tabCloseRequested.connect(self.__closeRequested)
         self.closeButton = None
     
     self.setCornerWidget(self.rightCornerWidget, Qt.TopRightCorner)
     
     self.__initMenu()
     self.contextMenuEditor = None
     self.contextMenuIndex = -1
     
     self.setTabContextMenuPolicy(Qt.CustomContextMenu)
     self.customTabContextMenuRequested.connect(self.__showContextMenu)
     
     ericPic = QPixmap(
         os.path.join(getConfig('ericPixDir'), 'eric_small.png'))
     self.emptyLabel = QLabel()
     self.emptyLabel.setPixmap(ericPic)
     self.emptyLabel.setAlignment(Qt.AlignVCenter | Qt.AlignHCenter)
     super(TabWidget, self).addTab(
         self.emptyLabel,
         UI.PixmapCache.getIcon("empty.png"), "")
Exemplo n.º 7
0
 def __init__(self, parent=None):
     """
     Constructor
     
     @param parent reference to the parent widget (QWidget)
     """
     super(IrcWidget, self).__init__(parent)
     self.setupUi(self)
     
     from .IrcNetworkManager import IrcNetworkManager
     self.__ircNetworkManager = IrcNetworkManager(self)
     
     self.__leaveButton = QToolButton(self)
     self.__leaveButton.setIcon(
         UI.PixmapCache.getIcon("ircCloseChannel.png"))
     self.__leaveButton.setToolTip(
         self.tr("Press to leave the current channel"))
     self.__leaveButton.clicked.connect(self.__leaveChannel)
     self.__leaveButton.setEnabled(False)
     self.channelsWidget.setCornerWidget(
         self.__leaveButton, Qt.BottomRightCorner)
     self.channelsWidget.setTabsClosable(False)
     if not isMacPlatform():
         self.channelsWidget.setTabPosition(QTabWidget.South)
     
     height = self.height()
     self.splitter.setSizes([height * 0.6, height * 0.4])
     
     self.__channelList = []
     self.__channelTypePrefixes = ""
     self.__userName = ""
     self.__identityName = ""
     self.__quitMessage = ""
     self.__nickIndex = -1
     self.__nickName = ""
     self.__server = None
     self.__registering = False
     
     self.__connectionState = IrcWidget.ServerDisconnected
     self.__sslErrorLock = False
     
     self.__buffer = ""
     self.__userPrefix = {}
     
     self.__socket = None
     if SSL_AVAILABLE:
         self.__sslErrorHandler = E5SslErrorHandler(self)
     else:
         self.__sslErrorHandler = None
     
     self.__patterns = [
         # :[email protected] PRIVMSG bar_ :some long message
         (re.compile(r":([^!]+)!([^ ]+)\sPRIVMSG\s([^ ]+)\s:(.*)"),
          self.__query),
         # :foo.bar.net COMMAND some message
         (re.compile(r""":([^ ]+)\s+([A-Z]+)\s+(.+)"""),
          self.__handleNamedMessage),
         # :foo.bar.net 123 * :info
         (re.compile(r""":([^ ]+)\s+(\d{3})\s+(.+)"""),
          self.__handleNumericMessage),
         # PING :ping message
         (re.compile(r"""PING\s+:(.*)"""), self.__ping),
     ]
     self.__prefixRe = re.compile(r""".*\sPREFIX=\((.*)\)([^ ]+).*""")
     self.__chanTypesRe = re.compile(r""".*\sCHANTYPES=([^ ]+).*""")
     
     ircPic = UI.PixmapCache.getPixmap("irc128.png")
     self.__emptyLabel = QLabel()
     self.__emptyLabel.setPixmap(ircPic)
     self.__emptyLabel.setAlignment(Qt.AlignVCenter | Qt.AlignHCenter)
     self.channelsWidget.addTab(self.__emptyLabel, "")
     
     # all initialized, do connections now
     self.__ircNetworkManager.dataChanged.connect(self.__networkDataChanged)
     self.networkWidget.initialize(self.__ircNetworkManager)
     self.networkWidget.connectNetwork.connect(self.__connectNetwork)
     self.networkWidget.editNetwork.connect(self.__editNetwork)
     self.networkWidget.joinChannel.connect(self.__joinChannel)
     self.networkWidget.nickChanged.connect(self.__changeNick)
     self.networkWidget.sendData.connect(self.__send)
     self.networkWidget.away.connect(self.__away)
     self.networkWidget.autoConnected.connect(self.autoConnected)
Exemplo n.º 8
0
 def __init__(self, vm):
     """
     Constructor
     
     @param vm view manager widget (Tabview)
     """
     E4TabWidget.__init__(self)
     self.setAttribute(Qt.WA_DeleteOnClose, True)
     
     self.__tabBar = TabBar(self)
     self.setTabBar(self.__tabBar)
     
     self.setUsesScrollButtons(True)
     self.setElideMode(Qt.ElideNone)
     if isMacPlatform():
         self.setDocumentMode(True)
     
     self.connect(self.__tabBar, SIGNAL("tabMoveRequested(int, int)"), 
                  self.moveTab)
     self.connect(self.__tabBar, SIGNAL("tabRelocateRequested(long, int, int)"), 
                  self.relocateTab)
     self.connect(self.__tabBar, SIGNAL("tabCopyRequested(long, int, int)"), 
                  self.copyTabOther)
     self.connect(self.__tabBar, SIGNAL("tabCopyRequested(int, int)"), 
                  self.copyTab)
     
     self.vm = vm
     self.editors = []
     
     self.indicator = E4Led(self)
     self.setCornerWidget(self.indicator, Qt.TopLeftCorner)
     
     self.rightCornerWidget = QWidget(self)
     self.rightCornerWidgetLayout = QHBoxLayout(self.rightCornerWidget)
     self.rightCornerWidgetLayout.setMargin(0)
     self.rightCornerWidgetLayout.setSpacing(0)
     
     self.__navigationMenu = QMenu(self)
     self.connect(self.__navigationMenu, SIGNAL("aboutToShow()"), 
                  self.__showNavigationMenu)
     self.connect(self.__navigationMenu, SIGNAL("triggered(QAction*)"), 
                  self.__navigationMenuTriggered)
     
     self.navigationButton = QToolButton(self)
     self.navigationButton.setIcon(UI.PixmapCache.getIcon("1downarrow.png"))
     self.navigationButton.setToolTip(self.trUtf8("Show a navigation menu"))
     self.navigationButton.setPopupMode(QToolButton.InstantPopup)
     self.navigationButton.setMenu(self.__navigationMenu)
     self.navigationButton.setEnabled(False)
     self.rightCornerWidgetLayout.addWidget(self.navigationButton)
     
     if Preferences.getUI("SingleCloseButton") or \
        not hasattr(self, 'setTabsClosable'):
         self.closeButton = QToolButton(self)
         self.closeButton.setIcon(UI.PixmapCache.getIcon("close.png"))
         self.closeButton.setToolTip(self.trUtf8("Close the current editor"))
         self.closeButton.setEnabled(False)
         self.connect(self.closeButton, SIGNAL("clicked(bool)"),
             self.__closeButtonClicked)
         self.rightCornerWidgetLayout.addWidget(self.closeButton)
     else:
         self.connect(self, SIGNAL("tabCloseRequested(int)"), 
             self.__closeRequested)
         self.closeButton = None
     
     self.setCornerWidget(self.rightCornerWidget, Qt.TopRightCorner)
     
     self.__initMenu()
     self.contextMenuEditor = None
     self.contextMenuIndex = -1
     
     self.setTabContextMenuPolicy(Qt.CustomContextMenu)
     self.connect(self, SIGNAL('customTabContextMenuRequested(const QPoint &, int)'),
                  self.__showContextMenu)
     
     ericPic = QPixmap(os.path.join(getConfig('ericPixDir'), 'eric_small.png'))
     self.emptyLabel = QLabel()
     self.emptyLabel.setPixmap(ericPic)
     self.emptyLabel.setAlignment(Qt.AlignVCenter | Qt.AlignHCenter)
     E4TabWidget.addTab(self, self.emptyLabel, UI.PixmapCache.getIcon("empty.png"), "")
Exemplo n.º 9
0
    def __init__(self, plugin):
        """
        Constructor
        
        @param plugin reference to the plugin object
        """
        super(DjangoPage, self).__init__()
        self.setupUi(self)
        self.setObjectName("DjangoPage")

        self.virtualEnvPy3Button.setIcon(UI.PixmapCache.getIcon("open.png"))
        self.virtualEnvPy2Button.setIcon(UI.PixmapCache.getIcon("open.png"))
        self.translationsButton.setIcon(UI.PixmapCache.getIcon("open.png"))

        self.__virtualEnvPy3Completer = E5DirCompleter(self.virtualEnvPy3Edit)
        self.__virtualEnvPy2Completer = E5DirCompleter(self.virtualEnvPy2Edit)
        self.__translationsCompleter = E5FileCompleter(self.translationsEdit)

        self.__plugin = plugin

        consoleList = []
        if isWindowsPlatform():
            consoleList.append("cmd.exe /c")
        elif isMacPlatform():
            consoleList.append("xterm -e")
            consoleList.append("/opt/X11/bin/xterm -e")
        else:
            consoleList.append("@konsole --workdir . -e")
            # KDE4/5 konsole spawns
            consoleList.append("gnome-terminal -e")
            consoleList.append("mate-terminal -e")
            consoleList.append("xfce4-terminal -e")
            consoleList.append("xterm -e")

        consoleNoCloseList = []
        if isWindowsPlatform():
            consoleNoCloseList.append("cmd.exe /k")
        elif isMacPlatform():
            consoleNoCloseList.append("xterm -hold -e")
            consoleNoCloseList.append("/opt/X11/bin/xterm -hold -e")
        else:
            consoleNoCloseList.append("@konsole --noclose --workdir . -e")
            # KDE4/5 konsole spawns
            consoleNoCloseList.append("gnome-terminal --profile=<noclose> -e")
            consoleNoCloseList.append("mate-terminal --profile=<noclose> -e")
            consoleNoCloseList.append("xfce4-terminal --hold -e")
            consoleNoCloseList.append("xterm -hold -e")

        self.consoleCommandCombo.addItems(consoleList)
        self.consoleCommandNoCloseCombo.addItems(consoleNoCloseList)

        # set initial values
        self.consoleCommandCombo.setEditText(
            self.__plugin.getPreferences("ConsoleCommand"))
        self.consoleCommandNoCloseCombo.setEditText(
            self.__plugin.getPreferences("ConsoleCommandNoClose"))

        self.serverAddressEdit.setText(
            self.__plugin.getPreferences("ServerAddress"))
        self.ipv6CheckBox.setChecked(self.__plugin.getPreferences("UseIPv6"))

        self.externalBrowserCheckBox.setChecked(
            self.__plugin.getPreferences("UseExternalBrowser"))

        self.appsRecentSpinBox.setValue(
            self.__plugin.getPreferences("RecentNumberApps"))

        self.virtualEnvPy2Edit.setText(
            self.__plugin.getPreferences("VirtualEnvironmentPy2"))
        self.plainPython2CheckBox.setChecked(
            self.__plugin.getPreferences("UsePlainPythonPy2"))

        self.virtualEnvPy3Edit.setText(
            self.__plugin.getPreferences("VirtualEnvironmentPy3"))
        self.plainPython3CheckBox.setChecked(
            self.__plugin.getPreferences("UsePlainPythonPy3"))

        self.translationsEdit.setText(
            self.__plugin.getPreferences("TranslationsEditor"))