コード例 #1
0
ファイル: Messagebox.py プロジェクト: JohnGGG/PyPad
from pypad.utils.config import config_reader, LOCATION
from PyQt5.QtWidgets import QWidget, QPushButton, QHBoxLayout, QDesktopWidget, QLabel, \
    QVBoxLayout, QLineEdit, QFileDialog, QAction, QApplication, QGridLayout, QSpacerItem
from PyQt5.QtGui import QFont, QIcon, QCursor, QFont, QFontMetrics
from PyQt5.QtCore import Qt
import shutil
import os
import random

configs = [config_reader(0), config_reader(1), config_reader(2)]

with open(LOCATION + "default.json") as choice:
    choiceIndex = int(choice.read())

editor = configs[choiceIndex]['editor']


class MessageBox(QWidget):
    def __init__(self, parent, error=None, helpword=None, index=choiceIndex):
        super().__init__()
        self.helpword = helpword
        self.layout = QHBoxLayout(self)
        self.parent = parent
        self.index = str(index)
        self.screen_geomtery = QDesktopWidget().screenGeometry(-1)
        self.width = self.screen_geomtery.width()
        self.height = self.screen_geomtery.height()
        self.path = None
        self.add_browser = None
        self.setWindowIcon(QIcon('resources/Python-logo-notext.svg_.png'))
        self.initUI()
コード例 #2
0
from PyQt5.QtGui import QSyntaxHighlighter, QTextCharFormat, QColor, QFont
from PyQt5.QtCore import QRegExp
import keyword
from pypad.utils.config import config_reader, LOCATION

config0 = config_reader(0)
config1 = config_reader(1)
config2 = config_reader(2)

with open(LOCATION + "default.json") as choice:
    choiceIndex = int(choice.read())

if choiceIndex == 0:
    editor = config0['editor']
elif choiceIndex == 1:
    editor = config1['editor']
elif choiceIndex == 2:
    editor = config2['editor']
else:
    editor = config0['editor']


class PyHighlighter(QSyntaxHighlighter):
    def __init__(self, parent=None, index=choiceIndex, *args):
        super(PyHighlighter, self).__init__(parent, *args)

        if index == "0":
            python = config0['files']['python']

        elif index == "1":
            python = config1['files']['python']