def __init__(self): QWidget.__init__(self) self.setContextMenuPolicy(Qt.DefaultContextMenu) self.setMinimumHeight(38) hbox = QHBoxLayout(self) self.btnPrevious = QPushButton(QIcon(resources.IMAGES["nav-code-left"]), "") self.btnPrevious.setToolTip(self.tr("Right click to change navigation options")) styles.set_style(self.btnPrevious, "tab-navigator") self.btnNext = QPushButton(QIcon(resources.IMAGES["nav-code-right"]), "") self.btnNext.setToolTip(self.tr("Right click to change navigation options")) styles.set_style(self.btnNext, "tab-navigator") hbox.addWidget(self.btnPrevious) hbox.addWidget(self.btnNext) self.setContentsMargins(0, 0, 0, 0) self.menuNavigate = QMenu(self.tr("Navigate")) self.codeAction = self.menuNavigate.addAction(self.tr("Code Jumps")) self.codeAction.setCheckable(True) self.codeAction.setChecked(True) self.bookmarksAction = self.menuNavigate.addAction(self.tr("Bookmarks")) self.bookmarksAction.setCheckable(True) self.breakpointsAction = self.menuNavigate.addAction(self.tr("Breakpoints")) self.breakpointsAction.setCheckable(True) # 0 = Code Jumps # 1 = Bookmarks # 2 = Breakpoints self.operation = 0 self.connect(self.codeAction, SIGNAL("triggered()"), self._show_code_nav) self.connect(self.breakpointsAction, SIGNAL("triggered()"), self._show_breakpoints) self.connect(self.bookmarksAction, SIGNAL("triggered()"), self._show_bookmarks)
def __init__(self, parent): super(MiniMap, self).__init__(parent) self.setWordWrapMode(QTextOption.NoWrap) self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.setReadOnly(True) self.setCenterOnScroll(True) self.setMouseTracking(True) self.setTextInteractionFlags(Qt.NoTextInteraction) self._parent = parent self.highlighter = None styles.set_style(self, 'minimap') self.max_line = 0 self.goe = QGraphicsOpacityEffect() self.setGraphicsEffect(self.goe) self.goe.setOpacity(settings.MINIMAP_MIN_OPACITY) self.animation = QPropertyAnimation(self.goe, "opacity")
def __init__(self, parent): QPlainTextEdit.__init__(self, parent) self._parent = parent self.setReadOnly(True) styles.set_style(self, 'editor') self.maxValue = 0 self.actualValue = 0 #traceback pattern self.patLink = re.compile(r'(\s)*File "(.*?)", line \d.+') #formats self.plain_format = QTextCharFormat() self.error_format = QTextCharFormat() self.error_format.setAnchor(True) self.error_format.setFontUnderline(True) self.error_format.setUnderlineStyle(QTextCharFormat.SingleUnderline) self.error_format.setUnderlineColor(Qt.red) self.error_format.setForeground(Qt.blue) self.error_format.setToolTip(self.tr("Click to show the source")) self.connect(self, SIGNAL("blockCountChanged(int)"), self._scroll_area)
def __init__(self): QWidget.__init__(self) self.setContextMenuPolicy(Qt.DefaultContextMenu) self.setMinimumHeight(38) hbox = QHBoxLayout(self) self.btnPrevious = QPushButton( QIcon(resources.IMAGES['nav-code-left']), '') self.btnPrevious.setToolTip( self.tr("Right click to change navigation options")) styles.set_style(self.btnPrevious, 'tab-navigator') self.btnNext = QPushButton(QIcon(resources.IMAGES['nav-code-right']), '') self.btnNext.setToolTip( self.tr("Right click to change navigation options")) styles.set_style(self.btnNext, 'tab-navigator') hbox.addWidget(self.btnPrevious) hbox.addWidget(self.btnNext) self.setContentsMargins(0, 0, 0, 0) self.menuNavigate = QMenu(self.tr("Navigate")) self.codeAction = self.menuNavigate.addAction(self.tr("Code Jumps")) self.codeAction.setCheckable(True) self.codeAction.setChecked(True) self.bookmarksAction = self.menuNavigate.addAction( self.tr("Bookmarks")) self.bookmarksAction.setCheckable(True) self.breakpointsAction = self.menuNavigate.addAction( self.tr("Breakpoints")) self.breakpointsAction.setCheckable(True) # 0 = Code Jumps # 1 = Bookmarks # 2 = Breakpoints self.operation = 0 self.connect(self.codeAction, SIGNAL("triggered()"), self._show_code_nav) self.connect(self.breakpointsAction, SIGNAL("triggered()"), self._show_breakpoints) self.connect(self.bookmarksAction, SIGNAL("triggered()"), self._show_bookmarks)
def __init__(self, project, content, itemRelated, parent=None): QWidget.__init__(self, parent) self.__content = content.toMap() self.__project = project self.__favorite = QPushButton(self) self.__delete = QPushButton(self) self.__delete.setIcon(QIcon(resources.IMAGES['delProj'])) self.__name = QLineEdit(self) self.__itemRelated = itemRelated self.setMouseTracking(True) styles.set_style(self, 'recent-project-list') self.__name.setText(self.__content[QString("name")].toString()) if QString("description") in self.__content: description = self.__content[QString("description")].toString() else: description = self.tr("no description available") self.__name.setToolTip(self.tr(self.__project) + '\n\n' + description) self.__delete.setToolTip(self.tr("Click to delete from the list")) self.__favorite.setToolTip(self.tr("Click to dock on the list")) hbox = QHBoxLayout() self.setLayout(hbox) hbox.setContentsMargins(0, 0, 0, 0) hbox.addWidget(self.__favorite) hbox.addWidget(self.__name) hbox.addWidget(self.__delete) self.__name.setCursor(QCursor(Qt.ArrowCursor)) self.__name.setReadOnly(True) self.connect(self.__favorite, SIGNAL("clicked(bool)"), self.__on_click_on_favorite) self.connect(self.__delete, SIGNAL("clicked(bool)"), self.__on_click_on_delete) #TODO: Change this click listen it doesn't work with ReadOnly = True self.connect(self.__name, SIGNAL("cursorPositionChanged(int, int)"), self.__on_click_on_name) self._set_favorite(self.__content[QString("isFavorite")].toBool())
def __init__(self, browserReference): self.browser_referece = browserReference QListWidget.__init__(self) self.setMouseTracking(True) styles.set_style(self, 'recent-project') self.load_items()
def __init__(self): QMainWindow.__init__(self) self.setWindowTitle('NINJA-IDE {Ninja-IDE Is Not Just Another IDE}') self.setMinimumSize(700, 500) #Load the size and the position of the main window self.load_window_geometry() #Profile handler self.profile = None #Opacity self.opacity = settings.MAX_OPACITY #Define Actions object before the UI self.actions = actions.Actions() #StatusBar self.status = status_bar.StatusBar(self) self.status.hide() self.setStatusBar(self.status) #Main Widget - Create first than everything else self.central = central_widget.CentralWidget(self) self.load_ui(self.central) self.setCentralWidget(self.central) #ToolBar self.toolbar = QToolBar(self) styles.set_style(self.toolbar, 'toolbar-default') self.toolbar.setToolTip(self.tr("Press and Drag to Move")) self.toolbar.setToolButtonStyle(Qt.ToolButtonIconOnly) self.addToolBar(settings.TOOLBAR_AREA, self.toolbar) if settings.HIDE_TOOLBAR: self.toolbar.hide() #Install Shortcuts after the UI has been initialized self.actions.install_shortcuts(self) self.connect(self.mainContainer, SIGNAL("currentTabChanged(QString)"), self.actions.update_explorer) #Menu menubar = self.menuBar() file_ = menubar.addMenu(self.tr("&File")) edit = menubar.addMenu(self.tr("&Edit")) view = menubar.addMenu(self.tr("&View")) source = menubar.addMenu(self.tr("&Source")) project = menubar.addMenu(self.tr("&Project")) self.pluginsMenu = menubar.addMenu(self.tr("&Addins")) about = menubar.addMenu(self.tr("Abou&t")) #The order of the icons in the toolbar is defined by this calls self._menuFile = menu_file.MenuFile(file_, self.toolbar, self) self._menuView = menu_view.MenuView(view, self.toolbar, self) self._menuEdit = menu_edit.MenuEdit(edit, self.toolbar) self._menuSource = menu_source.MenuSource(source) self._menuProject = menu_project.MenuProject(project, self.toolbar) self._menuPlugins = menu_plugins.MenuPlugins(self.pluginsMenu) self._menuAbout = menu_about.MenuAbout(about) self.load_toolbar() #Plugin Manager services = { 'editor': plugin_services.MainService(), 'toolbar': plugin_services.ToolbarService(self.toolbar), 'menuApp': plugin_services.MenuAppService(self.pluginsMenu), 'explorer': plugin_services.ExplorerService(), 'misc': plugin_services.MiscContainerService(self.misc)} serviceLocator = plugin_manager.ServiceLocator(services) self.plugin_manager = plugin_manager.PluginManager(resources.PLUGINS, serviceLocator) self.plugin_manager.discover() #load all plugins! self.plugin_manager.load_all() #Tray Icon self.trayIcon = updates.TrayIconUpdates(self) self.trayIcon.show() self.connect(self.mainContainer, SIGNAL("fileSaved(QString)"), self.show_status_message)
def __init__(self, parent): QWidget.__init__(self, parent) vbox = QVBoxLayout(self) self._parent = parent self.toolbar_settings = settings.TOOLBAR_ITEMS groupBoxExplorer = QGroupBox(self.tr("Explorer Panel:")) groupBoxGui = QGroupBox(self.tr("GUI Customization:")) groupBoxToolbar = QGroupBox(self.tr("Tool Bar Customization:")) groupBoxLang = QGroupBox(self.tr("Language:")) #Explorer vboxExplorer = QVBoxLayout(groupBoxExplorer) self._checkProjectExplorer = QCheckBox( self.tr("Show Project Explorer.")) self._checkSymbols = QCheckBox(self.tr("Show Symbols List.")) self._checkWebInspetor = QCheckBox(self.tr("Show Web Inspector.")) self._checkFileErrors = QCheckBox(self.tr("Show File Errors.")) vboxExplorer.addWidget(self._checkProjectExplorer) vboxExplorer.addWidget(self._checkSymbols) vboxExplorer.addWidget(self._checkWebInspetor) vboxExplorer.addWidget(self._checkFileErrors) #GUI self._btnCentralRotate = QPushButton( QIcon(resources.IMAGES['splitCPosition']), '') self._btnCentralRotate.setIconSize(QSize(64, 64)) self._btnCentralRotate.setCheckable(True) self._btnPanelsRotate = QPushButton( QIcon(resources.IMAGES['splitMPosition']), '') self._btnPanelsRotate.setIconSize(QSize(64, 64)) self._btnPanelsRotate.setCheckable(True) self._btnCentralOrientation = QPushButton( QIcon(resources.IMAGES['splitCRotate']), '') self._btnCentralOrientation.setIconSize(QSize(64, 64)) self._btnCentralOrientation.setCheckable(True) gridGuiConfig = QGridLayout(groupBoxGui) gridGuiConfig.addWidget(self._btnCentralRotate, 0, 0) gridGuiConfig.addWidget(self._btnPanelsRotate, 0, 1) gridGuiConfig.addWidget(self._btnCentralOrientation, 0, 2) gridGuiConfig.addWidget(QLabel( self.tr("Rotate Central")), 1, 0, Qt.AlignCenter) gridGuiConfig.addWidget(QLabel( self.tr("Rotate Lateral")), 1, 1, Qt.AlignCenter) gridGuiConfig.addWidget(QLabel( self.tr("Central Orientation")), 1, 2, Qt.AlignCenter) #GUI - Toolbar vbox_toolbar = QVBoxLayout(groupBoxToolbar) hbox_select_items = QHBoxLayout() label_toolbar = QLabel(self.tr("Toolbar Items:")) label_toolbar.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) hbox_select_items.addWidget(label_toolbar) self._comboToolbarItems = QComboBox() self._load_combo_data(self._comboToolbarItems) self._btnItemAdd = QPushButton( QIcon(resources.IMAGES['add']), '') self._btnItemAdd.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self._btnItemRemove = QPushButton( QIcon(resources.IMAGES['delete']), '') self._btnDefaultItems = QPushButton(self.tr("Default Items")) self._btnDefaultItems.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self._btnItemRemove.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) hbox_select_items.addWidget(self._comboToolbarItems) hbox_select_items.addWidget(self._btnItemAdd) hbox_select_items.addWidget(self._btnItemRemove) hbox_select_items.addWidget(self._btnDefaultItems) vbox_toolbar.addLayout(hbox_select_items) self._toolbar_items = QToolBar() self._toolbar_items.setToolButtonStyle(Qt.ToolButtonIconOnly) styles.set_style(self._toolbar_items, 'toolbar-customization') self._load_toolbar() vbox_toolbar.addWidget(self._toolbar_items) vbox_toolbar.addWidget(QLabel( self.tr("The New Item will be inserted after the item selected."))) #Language vboxLanguage = QVBoxLayout(groupBoxLang) vboxLanguage.addWidget(QLabel(self.tr("Select Language:"))) self._comboLang = QComboBox() self._comboLang.setEnabled(False) vboxLanguage.addWidget(self._comboLang) vboxLanguage.addWidget(QLabel(self.tr('Requires restart...'))) #Load Languages # self.thread = ThreadLangs() # self.connect(self.thread, SIGNAL("finished()"), self.load_langs) # self.thread.start() self._load_langs() # until the thread is working #Settings self._checkProjectExplorer.setChecked( settings.SHOW_PROJECT_EXPLORER) self._checkSymbols.setChecked(settings.SHOW_SYMBOLS_LIST) self._checkWebInspetor.setChecked(settings.SHOW_WEB_INSPECTOR) self._checkFileErrors.setChecked(settings.SHOW_ERRORS_LIST) #ui layout self._btnCentralRotate.setChecked(bin(settings.UI_LAYOUT)[-1] == '1') self._btnPanelsRotate.setChecked(bin( settings.UI_LAYOUT >> 1)[-1] == '1') self._btnCentralOrientation.setChecked( bin(settings.UI_LAYOUT >> 2)[-1] == '1') vbox.addWidget(groupBoxExplorer) vbox.addWidget(groupBoxGui) vbox.addWidget(groupBoxToolbar) vbox.addWidget(groupBoxLang) #Signals self.connect(self._btnCentralRotate, SIGNAL('clicked()'), central_widget.CentralWidget().splitter_central_rotate) self.connect(self._btnPanelsRotate, SIGNAL('clicked()'), central_widget.CentralWidget().splitter_misc_rotate) self.connect(self._btnCentralOrientation, SIGNAL('clicked()'), central_widget.CentralWidget().splitter_central_orientation) self.connect(self._btnItemAdd, SIGNAL("clicked()"), self.toolbar_item_added) self.connect(self._btnItemRemove, SIGNAL("clicked()"), self.toolbar_item_removed) self.connect(self._btnDefaultItems, SIGNAL("clicked()"), self.toolbar_items_default)
def __init__(self): QMainWindow.__init__(self) self.setWindowTitle('NINJA-IDE {Ninja-IDE Is Not Just Another IDE}') self.setMinimumSize(700, 500) #Load the size and the position of the main window self.load_window_geometry() #Profile handler self.profile = None #Opacity self.opacity = settings.MAX_OPACITY #Define Actions object before the UI self.actions = actions.Actions() #StatusBar self.status = status_bar.StatusBar(self) self.status.hide() self.setStatusBar(self.status) #Main Widget - Create first than everything else self.central = central_widget.CentralWidget(self) self.load_ui(self.central) self.setCentralWidget(self.central) #ToolBar self.toolbar = QToolBar(self) styles.set_style(self.toolbar, 'toolbar-default') self.toolbar.setToolTip(self.tr("Press and Drag to Move")) self.toolbar.setToolButtonStyle(Qt.ToolButtonIconOnly) self.addToolBar(settings.TOOLBAR_AREA, self.toolbar) if settings.HIDE_TOOLBAR: self.toolbar.hide() #Install Shortcuts after the UI has been initialized self.actions.install_shortcuts(self) self.connect(self.mainContainer, SIGNAL("currentTabChanged(QString)"), self.actions.update_explorer) #Menu menubar = self.menuBar() file_ = menubar.addMenu(self.tr("&File")) edit = menubar.addMenu(self.tr("&Edit")) view = menubar.addMenu(self.tr("&View")) source = menubar.addMenu(self.tr("&Source")) project = menubar.addMenu(self.tr("&Project")) self.pluginsMenu = menubar.addMenu(self.tr("&Addins")) about = menubar.addMenu(self.tr("Abou&t")) #The order of the icons in the toolbar is defined by this calls self._menuFile = menu_file.MenuFile(file_, self.toolbar, self) self._menuView = menu_view.MenuView(view, self.toolbar, self) self._menuEdit = menu_edit.MenuEdit(edit, self.toolbar) self._menuSource = menu_source.MenuSource(source) self._menuProject = menu_project.MenuProject(project, self.toolbar) self._menuPlugins = menu_plugins.MenuPlugins(self.pluginsMenu) self._menuAbout = menu_about.MenuAbout(about) self.load_toolbar() #Plugin Manager services = { 'editor': plugin_services.MainService(), 'toolbar': plugin_services.ToolbarService(self.toolbar), 'menuApp': plugin_services.MenuAppService(self.pluginsMenu), 'explorer': plugin_services.ExplorerService(), 'misc': plugin_services.MiscContainerService(self.misc) } serviceLocator = plugin_manager.ServiceLocator(services) self.plugin_manager = plugin_manager.PluginManager( resources.PLUGINS, serviceLocator) self.plugin_manager.discover() #load all plugins! self.plugin_manager.load_all() #Tray Icon self.trayIcon = updates.TrayIconUpdates(self) self.trayIcon.show() self.connect(self.mainContainer, SIGNAL("fileSaved(QString)"), self.show_status_message)