def initUI(self): iconPath = resourcePath('ico\\favicon.ico') imgPath = resourcePath('ico\\logo.png') checkButton = QPushButton("Check for updates") self.buttons = QDialogButtonBox(QDialogButtonBox.Ok, Qt.Horizontal, self) self.buttons.accepted.connect(self.accept) img = QLabel() img.setPixmap(QPixmap(imgPath)) img.setToolTip('You are more than the sum of what you consume.') self.updatesLabel = QLabel() #self.updatesLabel.setText('To report bugs or check for updates please visit <a href="http://rybafish.net">http://rybafish.net</a>.') self.infoLabel = QLabel() self.infoLabel.linkActivated.connect(self.rybafishDotNet) self.infoLabel.setText( '''To report bugs or check for updates please visit <a href="http://www.rybafish.net">http://rybafish.net</a>.''' ) txt = QLabel('''Ryba Fish Charts. Current version: %s, build %s. ''' % (version, build_date)) vbox = QVBoxLayout() hbox = QHBoxLayout() vbox2 = QVBoxLayout() vbox2.addStretch(1) vbox2.addWidget(txt) vbox2.addWidget(checkButton) vbox2.addWidget(self.updatesLabel) vbox2.addWidget(QLabel()) vbox2.addWidget(self.infoLabel) vbox2.addStretch(1) hbox.addWidget(img) hbox.addLayout(vbox2) vbox.addLayout(hbox) vbox.addWidget(self.buttons) checkButton.clicked.connect(self.checkUpdates) checkButton.resize(150, 150) self.setLayout(vbox) self.setWindowIcon(QIcon(iconPath)) #self.setGeometry(300, 300, 300, 150) self.setWindowTitle('About')
def execute(self): """""" # intialize thread support (hangs on winxp) #gtk.gdk.threads_init() # load Cillop-Midnite theme gtk.rc_add_default_file(resourcePath("themes/Cillop-Midnite/gtk-2.0/gtkrc")) settings = gtk.settings_get_default() settings.set_string_property("gtk-theme-name", "Cillop-Midnite", "") # load icon theme theme = gtk.icon_theme_get_default() theme.prepend_search_path(resourcePath('themes')) settings.set_string_property("gtk-icon-theme-name", "budabot-icon-theme", "") gtk.icon_size_register('status-icon-size', 24, 24) self.settingModel = SettingModel() self.botModel = BotModel(self.settingModel) self.botModel.connect('botRemoved', self.onBotRemoved) systrayController = SystrayController() controlPanelController = ControlPanelController(self.botModel, self.settingModel) controlPanelController.connect('action_triggered', self.onControlPanelAction) # open control panel when user select 'open' from systray's context menu systrayController.connect_object('open_requested', ControlPanelController.show, controlPanelController) # opens/closes control panel when user clicks systray icon systrayController.connect_object('toggle_requested', ControlPanelController.toggle, controlPanelController) # notify systray controller of control panel's visibility controlPanelController.connect('visibility_changed', systrayController.onControlPanelVisibilityChanged) # connect exit requests to quit()-method controlPanelController.connect_object('exit_requested', Application.quit, self) systrayController.connect_object('exit_requested', Application.quit, self) # show errors to user self.settingModel.connect('error', self.onError) self.settingModel.load() controlPanelController.show() # run Twisted + GTK event loop reactor.run() systrayController.hideIcon()
def handler(self, exctype, value, tb): log('[!] fatal exeption\n') #details = '%s: %s\n' % (str(exctype), str(value)) details = '%s.%s: %s\n\n' % (exctype.__module__, exctype.__qualname__, str(value)) #??? #self.errorSignal.emit() #sys._excepthook(exctype, value, traceback) for s in traceback.format_tb(tb): details += s.replace('\\n', '\n') log(details, nots=True) msgBox = QMessageBox() msgBox.setWindowTitle('Fatal error') msgBox.setText( 'Unhandled exception occured. Check the log file for details.') msgBox.setIcon(QMessageBox.Critical) msgBox.setDetailedText(details) iconPath = resourcePath('ico\\favicon.ico') msgBox.setWindowIcon(QIcon(iconPath)) msgBox.exec_() sys.exit(0)
def __init__(self, bot, configFile, parent): """Constructor method. bot - bot object which is being edited configFile - bot's config file which is being edited parent - a top level window, the config window will positioned on top this """ self.configFile = configFile self.builder = gtk.Builder() self.builder.add_from_file(resourcePath('configwindow.glade')) self.dialog = self.builder.get_object('configDialog') self.botRef = weakref.ref(bot) self.parentRef = weakref.ref(parent) # append bot name to dialog's title self.dialog.set_title(self.dialog.get_title() % bot.getName()) weakConnect(self.dialog, 'response', self.onConfigDialogResponse) weakConnect(self.dialog, 'response', self.onConfigDialogResponse) weakConnect(self.builder.get_object('dbTypeCombobox'), 'changed', self.onDbTypeChanged) weakConnect(self.builder.get_object('useProxyCheckbox'), 'toggled', self.onUseProxyToggled) # add buttons, must be added in Gnome's preferred order, see: # http://developer.gnome.org/hig-book/3.4/windows-alert.html.en#alert-button-order self.dialog.add_button(gtk.STOCK_CANCEL, self.RESPONSE_CANCEL) saveButton = self.dialog.add_button(gtk.STOCK_SAVE, self.RESPONSE_SAVE) saveButton.grab_default() # add alternative order for Windows, see: # http://msdn.microsoft.com/en-us/library/windows/desktop/aa511268.aspx#commitButtons self.dialog.set_alternative_button_order([self.RESPONSE_SAVE, self.RESPONSE_CANCEL]) # set tooltip texts to widgets for tooltipData in self.TOOLTIPS: widgetNames = tooltipData[0] text = tooltipData[1] for widgetName in widgetNames: widget = self.builder.get_object(widgetName) widget.set_tooltip_text(text)
def initUI(self, lastSearch): iconPath = resourcePath('ico\\favicon.ico') self.setWindowIcon(QIcon(iconPath)) self.str = QLineEdit(lastSearch) if lastSearch != '': self.str.selectAll() vbox = QHBoxLayout() searchBtn = QPushButton('Find') searchBtn.clicked.connect(self.search) #cancelBtn = QPushButton('Close') #vbox.addWidget(findLabel) vbox.addWidget(self.str) vbox.addStretch(1) vbox.addWidget(searchBtn) #vbox.addWidget(cancelBtn) self.setLayout(vbox) self.setWindowTitle('Find string...')
def createTabs(self): for widget in self.widgets: try: widget.deleteLater() except: pass self.widgets = [] self.tab = QTabWidget(self) self.tab.move(1, 0) self.tab.resize(self.size()) self.tab.resize(self.tab.width(), self.tab.height()-20) self.removeInstanceContainer = QVBoxLayout(self) self.cacheTabContainer = QVBoxLayout(self) self.modpackRepoContainer = QVBoxLayout(self) self.addInstanceTab = QWidget() self.removeInstanceTab = QWidget() self.cacheTab = QWidget() self.modpackRepoTab = QWidget() self.tab.addTab(self.addInstanceTab, "Create an Instance") self.tab.addTab(self.modpackRepoTab, "Modpack Repo") self.tab.addTab(self.removeInstanceTab, "Delete Instances") self.tab.addTab(self.cacheTab, "Manage Cached Modpacks") self.removeInstanceTab.setLayout(self.removeInstanceContainer) self.cacheTab.setLayout(self.cacheTabContainer) self.modpackRepoTab.setLayout(self.modpackRepoContainer) scroll = QScrollArea(self) self.removeInstanceContainer.addWidget(scroll) scroll.setWidgetResizable(True) scroll.resize(scroll.width(), scroll.height()-20) scrollContent = QWidget(scroll) self.removeInstanceLayout = QVBoxLayout(scrollContent) scrollContent.setLayout(self.removeInstanceLayout) scroll.setWidget(scrollContent) scroll = QScrollArea(self) self.cacheTabContainer.addWidget(scroll) scroll.setWidgetResizable(True) scrollContent = QWidget(scroll) self.cacheTabLayout = QVBoxLayout(scrollContent) scrollContent.setLayout(self.cacheTabLayout) scroll.setWidget(scrollContent) scroll = QScrollArea(self) self.modpackRepoContainer.addWidget(scroll) scroll.setWidgetResizable(True) scrollContent = QWidget(scroll) self.modpackRepoLayout = QVBoxLayout(scrollContent) scrollContent.setLayout(self.modpackRepoLayout) scroll.setWidget(scrollContent) self.refreshButton = QPushButton(self.modpackRepoTab) self.refreshButton.move(8, 8) self.refreshButton.resize(20, 20) icon = QIcon(utils.resourcePath("refresh.png")) self.refreshButton.setIcon(icon) self.refreshButton.clicked.connect(self.getModpackRepo.start) self.updateInstanceList() self.updateCacheList()
def __init__(self, parentWindow, botModel, settingModel): """Constructor method.""" self.settingModel = settingModel self.handler = None # load addbotwizard.glade file self.builder = gtk.Builder() self.builder.add_from_file(resourcePath('addbotwizard.glade')) self.assistant = Assistant() self.assistant.set_property('title', 'Budabot - Add Bot Wizard') # position the wizard on top of control panel's window self.assistant.set_transient_for(parentWindow) self.assistant.set_property('window-position', gtk.WIN_POS_CENTER_ON_PARENT) self.assistant.connect('apply', self.onApplyClicked) self.assistant.connect('cancel', self.onCancelClicked) self.assistant.connect('close', self.onCloseClicked) # create pages self.selectActionPage = SelectActionPage(self) self.selectImportPage = SelectImportPage(self) self.selectBotInstallDirPage = SelectBotInstallDirectoryPage(self) self.enterAccountInfoPage = EnterAccountInfoPage(self) self.enterCharacterInfoPage = EnterCharacterInfoPage(self) self.selectBotTypePage = SelectBotTypePage(self) self.enterSuperAdminPage = EnterSuperAdminPage(self) self.selectDBSettingsPage = SelectDatabaseSettingsPage(self) self.selectDBTypePage = SelectDatabaseTypePage(self) self.enterSqliteSettingsPage = EnterSqliteSettingsPage(self) self.enterMysqlSettingsPage = EnterMysqlSettingsPage(self) self.selectModuleStatusPage = SelectDefaultModuleStatusPage(self) self.botNamePage = NameBotPage(self) self.finishPage = FinishPage(self) # Add pages to the wizard self.assistant.appendPage(self.selectActionPage) # first appended page is the starting page self.assistant.appendPage(self.selectImportPage) self.assistant.appendPage(self.selectBotInstallDirPage) self.assistant.appendPage(self.enterAccountInfoPage) self.assistant.appendPage(self.enterCharacterInfoPage) self.assistant.appendPage(self.selectBotTypePage) self.assistant.appendPage(self.enterSuperAdminPage) self.assistant.appendPage(self.selectDBSettingsPage) self.assistant.appendPage(self.selectDBTypePage) self.assistant.appendPage(self.enterSqliteSettingsPage) self.assistant.appendPage(self.enterMysqlSettingsPage) self.assistant.appendPage(self.selectModuleStatusPage) self.assistant.appendPage(self.botNamePage) self.assistant.appendPage(self.finishPage) self.selectActionPage.connect('left', self.onSelectActionPageLeft) # connect any 'activate-link' signals (if available) to onLink() handler for object in self.builder.get_objects(): try: object.connect('activate-link', self.onLink) except TypeError: pass
def __init__(self, vid, mid, mode, infection_date, rsa_pub_key): print("PostInfection Object Created") self.victim_id = vid self.mail_id = mid self.mode = mode self.infection_date = infection_date self.rsa_pub_key = rsa_pub_key self.wallpaper_path = resourcePath("wallpaper.png",["images"]) print("Wallpaper :", self.wallpaper_path)
def menuImport(self): fname = QFileDialog.getOpenFileNames(self, 'Import...', None, 'Nameserver trace files (*.trc)') log(fname[0]) log('But I dont work...') if len(fname[0]) > 0: msgBox = QMessageBox() msgBox.setWindowTitle('Import') msgBox.setText('Not implemented yet') iconPath = resourcePath('ico\\favicon.ico') msgBox.setWindowIcon(QIcon(iconPath)) msgBox.setIcon(QMessageBox.Warning) msgBox.exec_()
def handler(self, exctype, value, tb): global ryba cwd = getcwd() log('[!] fatal exception\n') #details = '%s: %s\n' % (str(exctype), str(value)) details = '%s.%s: %s\n\n' % (exctype.__module__, exctype.__qualname__, str(value)) #??? #self.errorSignal.emit() #sys._excepthook(exctype, value, traceback) for s in traceback.format_tb(tb): details += '>>' + s.replace('\\n', '\n').replace(cwd, '..') log(details, nots=True) if ryba.tabs: for i in range(ryba.tabs.count() - 1, 0, -1): w = ryba.tabs.widget(i) if isinstance(w, sqlConsole.sqlConsole): w.delayBackup() try: if utils.cfg('saveLayout', True): ryba.dumpLayout() except Exception as e: log('[!] Exception during exception handler: %s' % str(e)) details += '\n[!] Exception during exception handler:\n' details += str(e) msgBox = QMessageBox() msgBox.setWindowTitle('Fatal error') msgBox.setText( 'Unhandled exception occured. Check the log file for details.') msgBox.setIcon(QMessageBox.Critical) msgBox.setDetailedText(details) iconPath = resourcePath('ico\\favicon.ico') msgBox.setWindowIcon(QIcon(iconPath)) msgBox.exec_() sys.exit(0)
def __init__(self, bot): """Constructor method.""" self.__gobject_init__() self.bot = bot # load botwindow.glade file self.builder = gtk.Builder() self.builder.add_from_file(resourcePath('botwindow.glade')) # get some widgets and objects for easier access self.botWindow = self.builder.get_object('botwindow') outputScrollArea = self.builder.get_object('outputScrollArea') self.outputView = self.builder.get_object('outputView') self.commandEntry = self.builder.get_object('commandInputEntry') self.destinationSelector = self.builder.get_object('destinationSelector') self.startButton = self.builder.get_object('startButton') self.restartButton = self.builder.get_object('restartButton') self.shutdownButton = self.builder.get_object('shutdownButton') self.terminateButton = self.builder.get_object('terminateButton') self.statusImage = self.builder.get_object('statusImage') self.statusLabel = self.builder.get_object('statusLabel') # call scrollViewToBottom() when scroll area's vertical scrollbar changes weakConnect(outputScrollArea.get_vadjustment(), 'changed', self.scrollViewToBottom) # call onCommandGiven() when user hits enter-key within the entry weakConnect(self.commandEntry, 'activate', self.onCommandGiven) # prevent deletion of the window on close weakConnect(self.botWindow, 'delete-event', self.onDeleteEvent) # be notified of bot's changes weakConnect(self.bot, 'notify::isRunning', self.onBotPropertyChanged) weakConnect(self.bot, 'notify::apiAccessible', self.onBotPropertyChanged) # handle button clicks weakConnect(self.startButton, 'clicked', self.onButtonClicked) weakConnect(self.restartButton, 'clicked', self.onButtonClicked) weakConnect(self.shutdownButton, 'clicked', self.onButtonClicked) weakConnect(self.terminateButton, 'clicked', self.onButtonClicked) self.outputView.set_buffer(self.bot.getConsoleModel()) self.statusImage.set_property('icon-size', gtk.icon_size_from_name('status-icon-size')) self.updateControlStates()
def initUI(self): #form = QFormLayout() form = QGridLayout() iconPath = resourcePath('ico\\favicon.ico') self.hostportEdit = QLineEdit() self.userEdit = QLineEdit() self.pwdEdit = QLineEdit() self.pwdEdit.setEchoMode(QLineEdit.Password) form.addWidget(QLabel('hostname:port'), 1, 1) form.addWidget(QLabel('user'), 2, 1) form.addWidget(QLabel('pwd'), 3, 1) form.addWidget(self.hostportEdit, 1, 2) form.addWidget(self.userEdit, 2, 2) form.addWidget(self.pwdEdit, 3, 2) checkButton = QPushButton("Check") self.buttons = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self) self.buttons.accepted.connect(self.accept) self.buttons.rejected.connect(self.reject) vbox = QVBoxLayout() #vbox.addWidget(checkButton) vbox.addLayout(form) vbox.addStretch(1) # vbox.addLayout(hbox) vbox.addWidget(self.buttons) self.setWindowIcon(QIcon(iconPath)) self.setLayout(vbox) #self.setGeometry(300, 300, 300, 150) self.setWindowTitle('Connection')
def displayInfoGUI(aeskeyfile): start_time_str = readInfectionDate(aeskeyfile) aptalgui_path = resourcePath("aptal.ui") app = QtWidgets.QApplication(sys.argv) window = InfoGUI(aptalgui_path, start_time_str) sys.exit(app.exec_())
class ChessBoard(): _chessBoard = [ [Pieces.BLACK_CASTLE, Pieces.BLACK_KNIGHT, Pieces.BLACK_BISHOP, Pieces.BLACK_QUEEN, Pieces.BLACK_KING, Pieces.BLACK_BISHOP, Pieces.BLACK_KNIGHT, Pieces.BLACK_CASTLE], [Pieces.BLACK_PAWN, Pieces.BLACK_PAWN, Pieces.BLACK_PAWN, Pieces.BLACK_PAWN, Pieces.BLACK_PAWN, Pieces.BLACK_PAWN, Pieces.BLACK_PAWN, Pieces.BLACK_PAWN], [None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None], [Pieces.WHITE_PAWN, Pieces.WHITE_PAWN, Pieces.WHITE_PAWN, Pieces.WHITE_PAWN, Pieces.WHITE_PAWN, Pieces.WHITE_PAWN, Pieces.WHITE_PAWN, Pieces.WHITE_PAWN], [Pieces.WHITE_CASTLE, Pieces.WHITE_KNIGHT, Pieces.WHITE_BISHOP, Pieces.WHITE_QUEEN, Pieces.WHITE_KING, Pieces.WHITE_BISHOP, Pieces.WHITE_KNIGHT, Pieces.WHITE_CASTLE] ] _rules = ChessRules(_chessBoard) _pieceDir = "images/pieces" _whiteDir = _pieceDir + "/default-white" _blackDir = _pieceDir + "/default-black" _images = { Pieces.WHITE_PAWN: pygame.image.load(resourcePath(_whiteDir + "/pawn.png")), Pieces.WHITE_KNIGHT: pygame.image.load(resourcePath(_whiteDir + "/knight.png")), Pieces.WHITE_BISHOP: pygame.image.load(resourcePath(_whiteDir + "/bishop.png")), Pieces.WHITE_CASTLE: pygame.image.load(resourcePath(_whiteDir + "/castle.png")), Pieces.WHITE_QUEEN: pygame.image.load(resourcePath(_whiteDir + "/queen.png")), Pieces.WHITE_KING: pygame.image.load(resourcePath(_whiteDir + "/king.png")), Pieces.BLACK_PAWN: pygame.image.load(resourcePath(_blackDir + "/pawn.png")), Pieces.BLACK_KNIGHT: pygame.image.load(resourcePath(_blackDir + "/knight.png")), Pieces.BLACK_BISHOP: pygame.image.load(resourcePath(_blackDir + "/bishop.png")), Pieces.BLACK_CASTLE: pygame.image.load(resourcePath(_blackDir + "/castle.png")), Pieces.BLACK_QUEEN: pygame.image.load(resourcePath(_blackDir + "/queen.png")), Pieces.BLACK_KING: pygame.image.load(resourcePath(_blackDir + "/king.png")) } def validMove(self, startPos, endPos): return self._rules.validMove(startPos, endPos) def movePiece(self, startPos, endPos): self._rules.movePiece(startPos, endPos) def turn(self): return self._rules.turn() def isCheck(self): return self._rules.isCheck() def isCheckmate(self): return self._rules.isCheckmate() def __str__(self): boardStr = "" rowIndex = 8 for row in self._chessBoard: boardStr += str(rowIndex) for column in row: boardStr += " " if(column is not None): boardStr += str(column) else: boardStr += "00" boardStr += "\n" rowIndex -= 1 boardStr += " a b c d e f g h\n" return boardStr def boardToPygameIndex(self, xpos, ypos): return (20 + (ypos * 50), 20 + (xpos * 50)) def pygameBlit(self, screen): rowIndex = 0 for row in self._chessBoard: columnIndex = 0 for piece in row: if(piece is not None): (dx, dy) = self.boardToPygameIndex(rowIndex, columnIndex) pieceImage = self._images[piece] pieceRect = pieceImage.get_rect().move(dx, dy) screen.blit(pieceImage, pieceRect) columnIndex += 1 rowIndex += 1
def initUI(self): # bottom left frame (hosts) hostsArea = QFrame(self) self.hostTable = hostsTable.hostsTable() # bottom right frame (KPIs) self.kpisTable = kpiTable.kpiTable() kpisTable = self.kpisTable # top (main chart area) self.chartArea = chartArea.chartArea() # establish hard links: kpisTable.kpiScales = self.chartArea.widget.nscales self.chartArea.widget.hosts = self.hostTable.hosts kpisTable.hosts = self.chartArea.widget.hosts #why do we have hosts inside widget? because we have all data there... kpisTable.hostKPIs = self.chartArea.hostKPIs kpisTable.srvcKPIs = self.chartArea.srvcKPIs kpisTable.nkpis = self.chartArea.widget.nkpis # bottm part left+right kpiSplitter = QSplitter(Qt.Horizontal) kpiSplitter.addWidget(self.hostTable) kpiSplitter.addWidget(kpisTable) kpiSplitter.setSizes([200, 380]) self.tabs = QTabWidget() console = sqlConsole.sqlConsole() # main window splitter mainSplitter = QSplitter(Qt.Vertical) kpisWidget = QWidget() lo = QVBoxLayout(kpisWidget) lo.addWidget(kpiSplitter) mainSplitter.addWidget(self.chartArea) mainSplitter.addWidget(kpisWidget) mainSplitter.setSizes([300, 90]) mainSplitter.setAutoFillBackground(True) # central widget #self.setCentralWidget(mainSplitter) kpisWidget.autoFillBackground = True self.tabs.addTab(mainSplitter, 'Chart') if cfg('experimental-notnow'): self.tabs.addTab(console, 'Sql') self.setCentralWidget(self.tabs) # service stuff self.statusbar = self.statusBar() #menu iconPath = resourcePath('ico\\favicon.ico') exitAct = QAction('&Exit', self) exitAct.setShortcut('Alt+Q') exitAct.setStatusTip('Exit application') exitAct.triggered.connect(self.menuQuit) aboutAct = QAction(QIcon(iconPath), '&About', self) aboutAct.setStatusTip('About this app') aboutAct.triggered.connect(self.menuAbout) dummyAct = QAction('&Dummy', self) dummyAct.setShortcut('Alt+D') dummyAct.setStatusTip('Dummy Data provider') dummyAct.triggered.connect(self.menuDummy) configAct = QAction('&Connect', self) configAct.setShortcut('Alt+C') configAct.setStatusTip('Configure connection') configAct.triggered.connect(self.menuConfig) importAct = QAction('&Import', self) importAct.setShortcut('Ctrl+I') importAct.setStatusTip('Import nameserver.trc') importAct.triggered.connect(self.menuImport) menubar = self.menuBar() fileMenu = menubar.addMenu('&File') fileMenu.addAction(aboutAct) fileMenu.addAction(configAct) if cfg('experimental'): fileMenu.addAction(importAct) fileMenu.addAction(dummyAct) fileMenu.addAction(exitAct) if cfg('experimental'): actionsMenu = menubar.addMenu('&Actions') fileMenu.addAction(aboutAct) fontAct = QAction('&Adjust Fonts', self) fontAct.setStatusTip('Adjust margins after font change (for example after move to secondary screen)') fontAct.triggered.connect(self.menuFont) reloadConfigAct = QAction('Reload &Config', self) reloadConfigAct.setStatusTip('Reload configuration file. Note: some values used during the connect or other one-time-actions') reloadConfigAct.triggered.connect(self.menuReloadConfig) actionsMenu.addAction(fontAct) actionsMenu.addAction(reloadConfigAct) reloadCustomKPIsAct = QAction('Reload Custom &KPIs', self) reloadCustomKPIsAct.setStatusTip('Reload definition of custom KPIs') reloadCustomKPIsAct.triggered.connect(self.menuReloadCustomKPIs) actionsMenu.addAction(reloadCustomKPIsAct) # finalization self.setGeometry(200, 200, 1400, 800) #self.setWindowTitle('SAP HANA Studio Light') # self.setWindowTitle('HANA Army Knife') self.setWindowTitle('Ryba Fish Charts') self.setWindowIcon(QIcon(iconPath)) self.show() ''' set up some interactions ''' # bind kpi checkbox signal kpisTable.checkboxToggle.connect(self.chartArea.checkboxToggle) # bind change scales signal kpisTable.adjustScale.connect(self.chartArea.adjustScale) kpisTable.setScale.connect(self.chartArea.setScale) # host table row change signal self.hostTable.hostChanged.connect(kpisTable.refill) # to fill hosts self.chartArea.hostsUpdated.connect(self.hostTable.hostsUpdated) # refresh self.chartArea.kpiToggled.connect(kpisTable.refill) # update scales signal self.chartArea.scalesUpdated.connect(kpisTable.updateScales) self.chartArea.scalesUpdated.emit() # it really not supposed to have any to update here #bind statusbox updating signals self.chartArea.statusMessage_.connect(self.statusMessage) self.chartArea.widget.statusMessage_.connect(self.statusMessage) self.chartArea.connected.connect(self.setTabName) log('init finish()') if self.chartArea.dp: self.chartArea.initDP()
def __init__(self, botModel, settingModel): """Constructor method.""" self.__gobject_init__() self.botModel = botModel self.settingModel = settingModel self.position = (200, 200) # load controlpanel.glade file self.builder = gtk.Builder() self.builder.add_from_file(resourcePath('controlpanel.glade')) self.view = self.builder.get_object('controlPanelWindow') self.botListView = self.builder.get_object('botListView') self.botListContextMenu = self.builder.get_object('botListContextMenu') self.contextItemOpen = self.builder.get_object('contextItemOpen') self.contextItemModify = self.builder.get_object('contextItemConfigure') self.contextItemRemove = self.builder.get_object('contextItemRemove') self.contextItemStart = self.builder.get_object('contextItemStart') self.contextItemRestart = self.builder.get_object('contextItemRestart') self.contextItemShutdown = self.builder.get_object('contextItemShutdown') self.contextItemTerminate = self.builder.get_object('contextItemTerminate') self.botListView.set_model(self.botModel) # setup column for bot's name def botNameSetter(column, cell, model, iter): bot = model[iter][BotModel.COLUMN_BOTOBJECT] name = bot.getName() cell.set_property('text', name) nameRenderer = gtk.CellRendererText() nameRenderer.set_property('height', 50) nameColumn = gtk.TreeViewColumn('Bot', nameRenderer) nameColumn.set_property('expand', True) nameColumn.set_cell_data_func(nameRenderer, botNameSetter) self.botListView.append_column(nameColumn) # setup column for bot's status def botStatusSetter(column, cell, model, iter): bot = model[iter][BotModel.COLUMN_BOTOBJECT] status = getBotUIStatus(bot) cell.set_property('icon-name', status[1]) statusRenderer = gtk.CellRendererPixbuf() statusRenderer.set_property('width', 50) statusRenderer.set_property('stock-size', gtk.icon_size_from_name('status-icon-size')) statusColumn = gtk.TreeViewColumn('Status', statusRenderer) statusColumn.set_cell_data_func(statusRenderer, botStatusSetter) self.botListView.append_column(statusColumn) # set default action as bold setItemAsBold(self.contextItemOpen) self.view.connect('delete-event', self.onDeleteEvent) self.view.connect('show', self.onViewShown) self.view.connect('hide', self.onViewHidden) self.botListView.connect('button-press-event', self.onBotListViewMousePressed) self.botListView.connect('key-press-event', self.onBotListViewKeyPressed) self.botListView.connect('row-activated', self.onBotListViewRowActivated) self.contextItemOpen.connect('activate', self.onContextMenuItemClicked, 'open') self.contextItemModify.connect('activate', self.onContextMenuItemClicked, 'configure') self.contextItemRemove.connect('activate', self.onContextMenuItemClicked, 'remove') self.contextItemStart.connect('activate', self.onContextMenuItemClicked, 'start') self.contextItemRestart.connect('activate', self.onContextMenuItemClicked, 'restart') self.contextItemShutdown.connect('activate', self.onContextMenuItemClicked, 'shutdown') self.contextItemTerminate.connect('activate', self.onContextMenuItemClicked, 'terminate') self.builder.get_object('addBotButton').connect('clicked', self.onAddBotClicked) self.builder.get_object('exitButton').connect('clicked', self.onExitClicked)
def menuConfig(self): if self.connectionConf is None: connConf = cfg('server') else: connConf = self.connectionConf conf, ok = configDialog.Config.getConfig(connConf) if ok: self.connectionConf = conf if ok and conf['ok']: try: self.statusMessage('Connecting...', False) self.repaint() self.chartArea.dp = dpDB.dataProvider(conf) # db data provider self.chartArea.initDP() if hasattr(self.chartArea.dp, 'dbProperties'): self.chartArea.widget.timeZoneDelta = self.chartArea.dp.dbProperties['timeZoneDelta'] self.chartArea.reloadChart() self.tabs.setTabText(0, conf['user'] + '@' + self.chartArea.dp.dbProperties['sid']) #setup keep alives if cfg('keepalive'): try: keepalive = int(cfg('keepalive')) self.chartArea.dp.enableKeepAlive(self, keepalive) except: log('wrong keepalive setting: %s' % (cfg('keepalive'))) except dbException as e: log('connect or init error:') if hasattr(e, 'message'): log(e.message) else: log(e) msgBox = QMessageBox() msgBox.setWindowTitle('Connection error') msgBox.setText('Connection failed: %s ' % (str(e))) iconPath = resourcePath('ico\\favicon.ico') msgBox.setWindowIcon(QIcon(iconPath)) msgBox.setIcon(QMessageBox.Warning) msgBox.exec_() self.statusMessage('', False) # raise(e) else: # cancel or parsing error if ok and conf['ok'] == False: #it's connection string dict in case of [Cancel] msgBox = QMessageBox() msgBox.setWindowTitle('Connection string') msgBox.setText('Could not start the connection. Please check the connection string: host, port, etc.') iconPath = resourcePath('ico\\favicon.ico') msgBox.setWindowIcon(QIcon(iconPath)) msgBox.setIcon(QMessageBox.Warning) msgBox.exec_() self.statusMessage('', False)
def createConfigObj(self): """This method loads the settings from a file.""" config = None # get a path to the ini-file + create directory for it configDir = appdirs.user_data_dir('Budabot Bot Manager', 'budabot.com', '1.0') if not os.path.exists(configDir): os.makedirs(configDir) configPath = os.path.join(configDir, 'settings.ini') # load the ini-file try: config = ConfigObj(infile = configPath, create_empty = True, encoding = 'UTF8', configspec = resourcePath('settingsspec.ini')) except(ConfigObjError, IOError), e: self.emit('error', 'Failed to read settings from "%s": %s' % (configPath, e)) return None
def launch(self): try: self.prc.kill() except: pass try: self.proxy.stop() except: pass try: # Checks if the user is an idiot. if self.loginBox.text() == "": raise TypeError("Username not specified!") if self.loggedIn: pass elif not self.loginBox.text().isalnum(): raise TypeError("Username not alphanumeric!") self.launchArgs = [] if self.instanceConfig["javaloc"] != "": self.launchArgs.append(self.instanceConfig["javaloc"]) else: self.launchArgs.append("java") for arg in self.instanceConfig["javaargs"].split(" -"): if not len(arg) < 3: self.launchArgs.append("-" + arg) if self.instanceConfig["proxyskin"] or self.instanceConfig["proxysound"] or self.instanceConfig["proxycape"]: self.proxy = utils.minecraftProxy(doSkinFix=self.instanceConfig["proxyskin"], doSoundFix=self.instanceConfig["proxysound"], doCapeFix=self.instanceConfig["proxycape"], loop=asyncio.new_event_loop()) self.proxy.start() self.launchArgs.append("-Dhttp.proxyHost=localhost") self.launchArgs.append("-Dhttp.proxyPort=25560") self.launchArgs.append("-Dhttps.proxyHost=localhost") self.launchArgs.append("-Dhttps.proxyPort=25560") self.launchArgs.append("-Xms" + self.instanceConfig["minram"]) self.launchArgs.append("-Xmx" + self.instanceConfig["maxram"]) self.launchArgs.append("-jar") self.launchArgs.append(utils.resourcePath("EasyMineLauncher.jar")) self.launchArgs.append("--lwjgl-dir=" + config.MC_DIR + "/instances/" + self.currentInstance + "/.minecraft/bin") self.launchArgs.append("--jar=" + config.MC_DIR + "/instances/" + self.currentInstance + "/.minecraft/bin/minecraft.jar") self.launchArgs.append("--native-dir=" + config.MC_DIR + "/instances/" + self.currentInstance + "/.minecraft/bin/natives") self.launchArgs.append("--parent-dir=" + config.MC_DIR + "/instances/" + self.currentInstance + "/.minecraft") self.launchArgs.append("--height=520") self.launchArgs.append("--width=870") self.launchArgs.append("--x=" + str(int((app.desktop().screenGeometry().width() / 2) - 435))) self.launchArgs.append("--y=" + str(int((app.desktop().screenGeometry().height() / 2) - 270))) self.launchArgs.append(self.creds.split(" ")[0]) try: self.launchArgs.append(self.creds.split(" ")[1]) except: pass utils.logger.info(self.creds.split(" ")) utils.logger.info(self.launchArgs[:-1]) # Overrides all references to %appdata%, $user.home and $home os.environ["APPDATA"] = config.MC_DIR + "/instances/" + self.currentInstance os.environ["USER.HOME"] = config.MC_DIR + "/instances/" + self.currentInstance os.environ["HOME"] = config.MC_DIR + "/instances/" + self.currentInstance # Launch the game. I ONLY DEAL IN ABSOLUTES. self.prc = subprocess.Popen(self.launchArgs, env=dict(os.environ)) self.launcherConfig["lastusedname"] = self.loginBox.text() utils.saveSettings(self.launcherConfig) try: self.pres.update(details="Playing", large_image="pymcllogo512", state="Selected modpack: " + self.currentInstance) except: pass self.loggedIn = False self.launchArgs = [] except Exception as e: # Tragic. self.error("Minecraft is unable to start. Make sure you have java and minecraft installed and an alphanumeric username set.\nCheck your launch args and java location if you have set any too.") utils.logger.info("Rejected username: " + self.loginBox.text()) utils.logger.info(e)
def menuConfig(self): if self.connectionConf is None: connConf = cfg('server') else: connConf = self.connectionConf conf, ok = configDialog.Config.getConfig(connConf, self) if ok: self.connectionConf = conf if ok and conf['ok']: try: # need to disconnect open consoles first... self.statusMessage('Disconnecing open consoles...', False) for i in range(self.tabs.count()): w = self.tabs.widget(i) if isinstance( w, sqlConsole.sqlConsole) and w.conn is not None: log('closing connection...') w.disconnectDB() w.indicator.status = 'disconnected' w.indicator.repaint() log('disconnected...') self.statusMessage('Connecting...', False) self.repaint() self.chartArea.setStatus('sync', True) self.chartArea.dp = dpDB.dataProvider(conf) # db data provider self.chartArea.setStatus('idle') for i in range(self.tabs.count()): w = self.tabs.widget(i) if isinstance(w, sqlConsole.sqlConsole): w.config = conf if cfg('saveKPIs', True): if self.layout and 'kpis' in self.layout.lo: self.chartArea.initDP(self.layout['kpis']) else: self.chartArea.initDP() starttime = datetime.datetime.now() - datetime.timedelta( seconds=12 * 3600) starttime -= datetime.timedelta( seconds=starttime.timestamp() % 3600) self.chartArea.fromEdit.setText( starttime.strftime('%Y-%m-%d %H:%M:%S')) self.chartArea.toEdit.setText('') else: self.chartArea.initDP() if hasattr(self.chartArea.dp, 'dbProperties'): self.chartArea.widget.timeZoneDelta = self.chartArea.dp.dbProperties[ 'timeZoneDelta'] self.chartArea.reloadChart() propStr = conf['user'] + '@' + self.chartArea.dp.dbProperties[ 'sid'] self.tabs.setTabText(0, propStr) self.setWindowTitle('RybaFish Charts [%s]' % propStr) #setup keep alives if cfg('keepalive'): try: keepalive = int(cfg('keepalive')) self.chartArea.dp.enableKeepAlive(self, keepalive) except: log('wrong keepalive setting: %s' % (cfg('keepalive'))) except dbException as e: log('Connect or init error:') if hasattr(e, 'message'): log(e.message) else: log(e) msgBox = QMessageBox() msgBox.setWindowTitle('Connection error') msgBox.setText('Connection failed: %s ' % (str(e))) iconPath = resourcePath('ico\\favicon.ico') msgBox.setWindowIcon(QIcon(iconPath)) msgBox.setIcon(QMessageBox.Warning) msgBox.exec_() self.statusMessage('', False) except Exception as e: log('Init exception not related to DB') log(str(e)) msgBox = QMessageBox() msgBox.setWindowTitle('Error') msgBox.setText( 'Init failed: %s \n\nSee more deteails in the log file.' % (str(e))) iconPath = resourcePath('ico\\favicon.ico') msgBox.setWindowIcon(QIcon(iconPath)) msgBox.setIcon(QMessageBox.Warning) msgBox.exec_() self.statusMessage('', False) else: # cancel or parsing error if ok and conf[ 'ok'] == False: #it's connection string dict in case of [Cancel] msgBox = QMessageBox() msgBox.setWindowTitle('Connection string') msgBox.setText( 'Could not start the connection. Please check the connection string: host, port, etc.' ) iconPath = resourcePath('ico\\favicon.ico') msgBox.setWindowIcon(QIcon(iconPath)) msgBox.setIcon(QMessageBox.Warning) msgBox.exec_() self.statusMessage('', False)
def initUI(self): if cfg('saveLayout', True): self.layout = Layout(True) if self.layout['running']: answer = utils.yesNoDialog( 'Warning', 'Another RybaFish is already running, all the layout and autosave features will be disabled.\n\nExit now?', ignore=True) #answer = utils.yesNoDialog('Warning', 'RybaFish is already running or crashed last time, all the layout and autosave features will be disabled.\n\nExit now?', ignore = True) if answer == True or answer is None: exit(0) if answer == 'ignore': log('Ignoring the layout') else: self.layout = None else: self.layout['running'] = True self.layout.dump() else: self.layout = Layout() # bottom left frame (hosts) hostsArea = QFrame(self) self.hostTable = hostsTable.hostsTable() # bottom right frame (KPIs) self.kpisTable = kpiTable.kpiTable() kpisTable = self.kpisTable # top (main chart area) self.chartArea = chartArea.chartArea() ind = indicator() self.chartArea.indicator = ind # establish hard links: kpisTable.kpiScales = self.chartArea.widget.nscales self.chartArea.widget.hosts = self.hostTable.hosts kpisTable.hosts = self.chartArea.widget.hosts #why do we have hosts inside widget? because we have all data there... kpisTable.hostKPIs = self.chartArea.hostKPIs kpisTable.srvcKPIs = self.chartArea.srvcKPIs kpisTable.nkpis = self.chartArea.widget.nkpis # bottm part left+right self.kpiSplitter = QSplitter(Qt.Horizontal) self.kpiSplitter.addWidget(self.hostTable) self.kpiSplitter.addWidget(kpisTable) self.kpiSplitter.setSizes([200, 380]) self.tabs = QTabWidget() # self.tabs.currentChanged.connect(self.tabChanged) # main window splitter self.mainSplitter = QSplitter(Qt.Vertical) kpisWidget = QWidget() lo = QVBoxLayout(kpisWidget) lo.addWidget(self.kpiSplitter) self.mainSplitter.addWidget(self.chartArea) self.mainSplitter.addWidget(kpisWidget) if self.layout is not None: if self.layout['mainSplitter']: self.mainSplitter.setSizes(self.layout['mainSplitter']) else: self.mainSplitter.setSizes([300, 90]) if self.layout['kpiSplitter']: self.kpiSplitter.setSizes(self.layout['kpiSplitter']) else: self.kpiSplitter.setSizes([200, 380]) if self.layout['hostTableWidth']: hostTableWidth = self.layout['hostTableWidth'] for i in range(self.hostTable.columnCount()): if i > len(hostTableWidth) - 1: break self.hostTable.setColumnWidth(i, hostTableWidth[i]) if self.layout['KPIsTableWidth']: KPIsTableWidth = self.layout['KPIsTableWidth'] for i in range(self.kpisTable.columnCount()): if i > len(KPIsTableWidth) - 1: break self.kpisTable.setColumnWidth(i, KPIsTableWidth[i]) else: self.mainSplitter.setSizes([300, 90]) self.kpiSplitter.setSizes([200, 380]) self.mainSplitter.setAutoFillBackground(True) # central widget #self.setCentralWidget(mainSplitter) kpisWidget.autoFillBackground = True self.tabs.addTab(self.mainSplitter, 'Chart') self.chartArea.selfRaise.connect(self.raiseTab) ind.iClicked.connect(self.chartArea.indicatorSignal) self.setCentralWidget(self.tabs) # service stuff self.statusbar = self.statusBar() self.statusbar.addPermanentWidget(ind) #menu iconPath = resourcePath('ico\\favicon.ico') exitAct = QAction('&Exit', self) exitAct.setShortcut('Alt+Q') exitAct.setStatusTip('Exit application') exitAct.triggered.connect(self.menuQuit) dummyAct = QAction('&Dummy', self) dummyAct.setShortcut('Alt+D') dummyAct.setStatusTip('Dummy Data provider') dummyAct.triggered.connect(self.menuDummy) configAct = QAction('&Connect', self) configAct.setShortcut('Alt+C') configAct.setStatusTip('Configure connection') configAct.triggered.connect(self.menuConfig) importAct = QAction('&Import nameserver history trace', self) importAct.setShortcut('Ctrl+I') importAct.setStatusTip('Import nameserver.trc') importAct.triggered.connect(self.menuImport) sqlConsAct = QAction('New &SQL Console', self) sqlConsAct.setShortcut('Alt+S') sqlConsAct.setStatusTip('Create SQL Console') sqlConsAct.triggered.connect(self.menuSQLConsole) openAct = QAction('&Open file in new sql console', self) openAct.setShortcut('Ctrl+O') openAct.setStatusTip('Open new console with the file') openAct.triggered.connect(self.menuOpen) saveAct = QAction('&Save sql to a file', self) saveAct.setShortcut('Ctrl+S') saveAct.setStatusTip('Saves sql from current console to a file') saveAct.triggered.connect(self.menuSave) menubar = self.menuBar() fileMenu = menubar.addMenu('&File') fileMenu.addAction(configAct) fileMenu.addAction(importAct) fileMenu.addAction(sqlConsAct) fileMenu.addAction(openAct) fileMenu.addAction(saveAct) if cfg('experimental'): fileMenu.addAction(dummyAct) fileMenu.addAction(exitAct) actionsMenu = menubar.addMenu('&Actions') if cfg('experimental'): # fileMenu.addAction(aboutAct) -- print not sure why its here fontAct = QAction('&Adjust Fonts', self) fontAct.setStatusTip( 'Adjust margins after font change (for example after move to secondary screen)' ) fontAct.triggered.connect(self.menuFont) actionsMenu.addAction(fontAct) # issue #255 reloadConfigAct = QAction('Reload &Config', self) reloadConfigAct.setStatusTip( 'Reload configuration file. Note: some values used during the connect or other one-time-actions (restart required).' ) reloadConfigAct.triggered.connect(self.menuReloadConfig) actionsMenu.addAction(reloadConfigAct) reloadCustomKPIsAct = QAction('Reload Custom &KPIs', self) reloadCustomKPIsAct.setStatusTip('Reload definition of custom KPIs') reloadCustomKPIsAct.triggered.connect(self.menuReloadCustomKPIs) actionsMenu.addAction(reloadCustomKPIsAct) # help menu part aboutAct = QAction(QIcon(iconPath), '&About', self) aboutAct.setStatusTip('About this app') aboutAct.triggered.connect(self.menuAbout) confHelpAct = QAction('Configuration', self) confHelpAct.setStatusTip('Configuration options description') confHelpAct.triggered.connect(self.menuConfHelp) confCustomHelpAct = QAction('Custom KPIs', self) confCustomHelpAct.setStatusTip('Short manual on custom KPIs') confCustomHelpAct.triggered.connect(self.menuCustomConfHelp) confTipsAct = QAction('Tips and tricks', self) confTipsAct.setStatusTip('Tips and tricks description') confTipsAct.triggered.connect(self.menuTips) helpMenu = menubar.addMenu('&Help') helpMenu.addAction(confHelpAct) helpMenu.addAction(confCustomHelpAct) helpMenu.addAction(confTipsAct) helpMenu.addAction(aboutAct) # finalization if self.layout is not None and self.layout['pos'] and self.layout[ 'size']: pos = self.layout['pos'] size = self.layout['size'] #print('screen number', QApplication.desktop().screenNumber()) #print('number of screens', QApplication.desktop().screenCount()) #print('available geometry:', QApplication.desktop().availableGeometry()) #print('screen geometry:', QApplication.desktop().screenGeometry()) r = QRect(pos[0], pos[1], size[0], size[1]) if QApplication.desktop().screenCount() == 1: # only when just one screen is available... if not QApplication.desktop().screenGeometry().contains( r) and not cfg('dontAutodetectScreen'): #the window will not be visible so jump to the main screen: (pos[0], pos[1]) = (100, 50) #self.setGeometry(pos[0] + 8, pos[1] + 31, size[0], size[1]) #self.setGeometry(pos[0], pos[1], size[0], size[1]) self.move(pos[0], pos[1]) self.resize(size[0], size[1]) else: self.setGeometry(200, 200, 1400, 800) self.setWindowTitle('RybaFish Charts') self.setWindowIcon(QIcon(iconPath)) scrollPosition = [] if cfg('saveOpenTabs', True) and self.layout is not None and self.layout['tabs']: for t in self.layout['tabs']: if len(t) != 4: continue console = sqlConsole.sqlConsole(self, None, '?') console.nameChanged.connect(self.changeActiveTabName) console.cons.closeSignal.connect(self.closeTab) self.tabs.addTab(console, console.tabname) ind = indicator() console.indicator = ind console.selfRaise.connect(self.raiseTab) ind.iClicked.connect(console.reportRuntime) self.statusbar.addPermanentWidget(ind) self.tabs.setCurrentIndex(self.tabs.count() - 1) if t[0] is not None or t[1] is not None: # such a tab should not ever be saved (this call will just open fileOpen dialog), anyway... # should we even create such a tab? console.openFile(t[0], t[1]) pos = t[2] block = t[3] scrollPosition.append(block) if isinstance(pos, int) and isinstance(block, int): cursor = console.cons.textCursor() cursor.setPosition(pos, cursor.MoveAnchor) console.cons.setTextCursor(cursor) indx = self.layout['currentTab'] if isinstance(indx, int): self.tabs.setCurrentIndex(indx) w = self.tabs.widget(indx) if isinstance(w, sqlConsole.sqlConsole): w.cons.setFocus() else: self.tabs.setCurrentIndex(0) self.show() #scroll everything to stored position for i in range(self.tabs.count() - 1, 0, -1): w = self.tabs.widget(i) if isinstance(w, sqlConsole.sqlConsole): if i - 1 < len(scrollPosition): block = scrollPosition[i - 1] w.cons.edit.verticalScrollBar().setValue(block) else: log('[w] scroll position list out of range, ignoring scrollback...' ) ''' set up some interactions ''' # bind kpi checkbox signal kpisTable.checkboxToggle.connect(self.chartArea.checkboxToggle) # bind change scales signal kpisTable.adjustScale.connect(self.chartArea.adjustScale) kpisTable.setScale.connect(self.chartArea.setScale) # host table row change signal self.hostTable.hostChanged.connect(kpisTable.refill) # to fill hosts self.chartArea.hostsUpdated.connect(self.hostTable.hostsUpdated) # refresh self.chartArea.kpiToggled.connect(kpisTable.refill) # update scales signal self.chartArea.scalesUpdated.connect(kpisTable.updateScales) log('self.scalesUpdated.emit() #0', 5) self.chartArea.scalesUpdated.emit( ) # it really not supposed to have any to update here #bind statusbox updating signals self.chartArea.statusMessage_.connect(self.statusMessage) self.chartArea.widget.statusMessage_.connect(self.statusMessage) self.chartArea.connected.connect(self.setTabName) log('init finish()') # offline console tests if cfg('developmentMode'): #tname = sqlConsole.generateTabName() #idx = self.tabs.count() self.sqlTabCounter += 1 idx = self.sqlTabCounter if idx > 1: tname = 'sql' + str(idx) else: tname = 'sql' console = sqlConsole.sqlConsole(self, None, tname) console.nameChanged.connect(self.changeActiveTabName) from SQLSyntaxHighlighter import SQLSyntaxHighlighter self.tabs.addTab(console, tname) console.selfRaise.connect(self.raiseTab) self.tabs.setCurrentIndex(self.tabs.count() - 1) self.SQLSyntax = SQLSyntaxHighlighter(console.cons.document()) #console.cons.setPlainText('select * from dummy;\n\nselect \n *\n from dummy;\n\nselect * from m_host_information;'); ind = indicator() console.indicator = ind self.statusbar.addPermanentWidget(ind) ind.iClicked.connect(console.reportRuntime) if cfg('developmentMode'): console.cons.setPlainText('''select 0 from dummy; create procedure ... ( (as begin) select * from dummy); end; where timestamp between '2020-02-10 00:00:00' and '2020-02-16 23:59:59' -- test comment where not "NAME1" = '' and "DOKST" in ('D0', 'D2') and (1 = 2) select 1 from dummy; select 2 from dummy; select 3 from dummy;''') console.dummyResultTable() self.statusMessage('', False) if self.chartArea.dp: self.chartArea.initDP()