Exemplo n.º 1
0
    def __init__(self, path):
        WinterObject.__init__(self)
        self.path = os.path.expanduser(path)
        self.text = ''
        try:
            self.config = WinterConfig(open(self.path + '/__page.cfg'))
            print(self.config)
            # print(self.prefs, self.prefs.cfg)
            # self.config = self.prefs.cfg

            if not self.config:
                raise IOError()
        except IOError:
            f = open(self.path + '/__page.cfg', 'w')
            f.write('cfg: !mapping\n    empty: ""')
            f.close()
            self.config = WinterConfig(open(self.path + '/__page.cfg'))
            # self.config = self.prefs.cfg

            self.config.title = os.path.split(path)[1]
            self.config.template = API().config.options.app.default_template

        #        finally:
        self.title = self.config.title
        self.template = self.config.template
Exemplo n.º 2
0
 def __init__(self, name, activate=None, deactivate=None, icon=rules.DefaultIcon):
     WinterObject.__init__(self)
     self.name = name
     self._activate = activate
     self._deactivate = deactivate
     self.target = None
     self.icon = icon
     self.short_info = self.info
     self.info_postfix = ''
     self.activated = False
Exemplo n.º 3
0
 def __init__(self, name, items, enchant):
     WinterObject.__init__(self)
     self.name = name
     self.items = items
     self.enchant = enchant
     self.generated_items = []
     for n, item in enumerate(self.items):
         if not isinstance(item, Wearable):
             item = ItemPrototypes[item]
             self.items[n] = item
         item.from_set = self
Exemplo n.º 4
0
 def __init__(self, name, items, enchant):
     WinterObject.__init__(self)
     self.name = name
     self.items = items
     self.enchant = enchant
     self.generated_items = []
     for n, item in enumerate(self.items):
         if not isinstance(item, Wearable):
             item = ItemPrototypes[item]
             self.items[n] = item
         item.from_set = self
Exemplo n.º 5
0
 def __init__(self, name, icon=rules.DefaultIcon, weight=0, desc='', quality=3, material=None, rarity=0):
     WinterObject.__init__(self)
     self.name = name
     self.weight = weight
     self.inv = None
     self.material = material
     self.rarity = rarity
     self.quality = quality
     self.is_id = False
     self.icon = icon
     self.desc = desc
Exemplo n.º 6
0
    def __init__(self, every, total=0, **kwargs):
        WinterObject.__init__(self, **kwargs)
        QRunnable.__init__(self)
        self.setAutoDelete(False)
        self.timer = QTimer()
        self.timer.timeout.connect(self._shot)
        self.every = every
        self.total = total
        self.sum = 0

        self.first = True
Exemplo n.º 7
0
 def __init__(self, name, items=[], coins=0):
     WinterObject.__init__(self)
     self.name = name
     self.items = items
     self.coins = coins
     for item in self.items[:]:
         if item is None or not item:
             self.items.remove(item)
     for n, item in enumerate(self.items):
         if not isinstance(item, Item):
             item = ItemPrototypes[item]
             self.items[n] = item
Exemplo n.º 8
0
 def __init__(self, name, items=[], coins=0):
     WinterObject.__init__(self)
     self.name = name
     self.items = items
     self.coins = coins
     for item in self.items[:]:
         if item is None or not item:
             self.items.remove(item)
     for n, item in enumerate(self.items):
         if not isinstance(item, Item):
             item = ItemPrototypes[item]
             self.items[n] = item
Exemplo n.º 9
0
 def __init__(self, *args, **kwargs):
     QAction.__init__(self, *args)
     WinterObject.__init__(self)
     self.title = self.text()
     self.api = API()
     if 'icon' in kwargs:
         icon = kwargs['icon']
         self.orig_icon = QIcon(self.api.icons[icon])
         self.setIcon(QIcon.fromTheme(icon, QIcon(self.api.icons[icon])))
     if isinstance(args[0], QIcon):
         icon = args[0]
         self.orig_icon = icon
         self.setIcon(icon)
Exemplo n.º 10
0
 def __init__(self, *args, **kwargs):
     QAction.__init__(self, *args)
     WinterObject.__init__(self)
     self.title = self.text()
     self.api = API()
     if 'icon' in kwargs:
         icon = kwargs['icon']
         self.orig_icon = QIcon(self.api.icons[icon])
         self.setIcon(QIcon.fromTheme(icon, QIcon(self.api.icons[icon])))
     if isinstance(args[0], QIcon):
         icon = args[0]
         self.orig_icon = icon
         self.setIcon(icon)
Exemplo n.º 11
0
 def __init__(self, title, pattern, color, font, font_size=10, offset=0, bold=False, italic=False):
     WinterObject.__init__(self)
     self.title = title
     self.pattern = pattern
     self.color = QColor(color)
     self.offset = offset
     self.bold = bold
     self.italic = italic
     self.font_size = font_size
     self.font = QFont(font)
     self.font.setBold(self.bold)
     self.font.setItalic(self.italic)
     self.font.setPointSize(self.font_size)
Exemplo n.º 12
0
 def __init__(self,
              name,
              activate=None,
              deactivate=None,
              icon=rules.DefaultIcon):
     WinterObject.__init__(self)
     self.name = name
     self._activate = activate
     self._deactivate = deactivate
     self.target = None
     self.icon = icon
     self.short_info = self.info
     self.info_postfix = ''
     self.activated = False
Exemplo n.º 13
0
 def __init__(self, name, effects=None, icon=rules.DefaultIcon, namepostfix='', **kwargs):
     WinterObject.__init__(self, **kwargs)
     self.name = name
     self.effects = []
     self.icon = icon
     self.namepostfix = namepostfix
     if effects is not None:
         if isinstance(effects, list):
             for effect in effects:
                 if isinstance(effect, Effect):
                     self.effects.append(effect)
                     effect.info_postfix += '<br>Gained from %s' % self.name
         else:
             raise TypeError('Wrong effects list definition')
Exemplo n.º 14
0
 def __init__(self,
              name,
              icon=rules.DefaultIcon,
              weight=0,
              desc='',
              quality=3,
              material=None,
              rarity=0):
     WinterObject.__init__(self)
     self.name = name
     self.weight = weight
     self.inv = None
     self.material = material
     self.rarity = rarity
     self.quality = quality
     self.is_id = False
     self.icon = icon
     self.desc = desc
Exemplo n.º 15
0
 def __init__(self,
              name,
              effects=None,
              icon=rules.DefaultIcon,
              namepostfix='',
              **kwargs):
     WinterObject.__init__(self, **kwargs)
     self.name = name
     self.effects = []
     self.icon = icon
     self.namepostfix = namepostfix
     if effects is not None:
         if isinstance(effects, list):
             for effect in effects:
                 if isinstance(effect, Effect):
                     self.effects.append(effect)
                     effect.info_postfix += '<br>Gained from %s' % self.name
         else:
             raise TypeError('Wrong effects list definition')
Exemplo n.º 16
0
 def __init__(self,
              title,
              pattern,
              color,
              font,
              font_size=10,
              offset=0,
              bold=False,
              italic=False):
     WinterObject.__init__(self)
     self.title = title
     self.pattern = pattern
     self.color = QColor(color)
     self.offset = offset
     self.bold = bold
     self.italic = italic
     self.font_size = font_size
     self.font = QFont(font)
     self.font.setBold(self.bold)
     self.font.setItalic(self.italic)
     self.font.setPointSize(self.font_size)
Exemplo n.º 17
0
    def __init__(self, path):
        WinterObject.__init__(self)
        self.path = os.path.expanduser(path)
        self.text = ''
        try:
            self.prefs = WinterConfig(file(self.path + '/__page.cfg'))
            self.config = self.prefs.cfg

            if not self.config:
                raise IOError()
        except IOError:
            f = file(self.path + '/__page.cfg', 'w')
            f.write('cfg:{}')
            f.close()
            self.prefs = WinterConfig(file(self.path + '/__page.cfg'))
            self.config = self.prefs.cfg

            self.config['title'] = os.path.split(path)[1].decode('utf-8')
            self.config['template'] = API().config.options.app.default_template

        #        finally:
        self.title = self.config.title
        self.template = self.config.template
Exemplo n.º 18
0
 def __init__(self,map):
     list.__init__(self)
     WinterObject.__init__(self)
     self.map=map
Exemplo n.º 19
0
 def __init__(self, parent=None):
     QTableWidget.__init__(self, parent)
     WinterObject.__init__(self)
Exemplo n.º 20
0
 def __init__(self, parent=None):
     QTableWidget.__init__(self, parent)
     WinterObject.__init__(self)
Exemplo n.º 21
0
    def __init__(self, parent, filename='', lexer='', autosave=True):
        FocusProxy.__init__(self)
        WinterObject.__init__(self)
        self.QSCI_SUPPORT = QSCI_SUPPORT
        self.parent = parent
        self.autosave = autosave
        try:
            self.api = parent.API()
        except AttributeError:
            from .baseQt import API

            self.api = API()
        self.filename = filename
        lay = QVBoxLayout()
        self.tb = QToolBar(self)
        lay.addWidget(self.tb)

        self.tb_save = QToolButton()
        #        self.tb_save.setIcon(QIcon.fromTheme('document-save', QIcon(self.api.icons['filesave'])))
        #        self.connect(self.tb_save, SIGNAL("clicked()"), self.save)
        #        self.tb.addWidget(self.tb_save)

        if QSCI_SUPPORT:
            editor = QsciScintilla(self)
            editor.setUtf8(True)
            self.lexers = {'Bash': QsciLexerBash, 'Batch': QsciLexerBatch, 'CMake': QsciLexerCMake, 'CPP': QsciLexerCPP,
                           'CSS': QsciLexerCSS, 'D': QsciLexerD, 'Diff': QsciLexerDiff, 'Fortran': QsciLexerFortran77,
                           'HTML': QsciLexerHTML, 'Lua': QsciLexerLua, 'Make': QsciLexerMakefile,
                           'Pascal': QsciLexerPascal,
                           'Perl': QsciLexerPerl, 'PostScript': QsciLexerPostScript, 'POV': QsciLexerPOV,
                           'Properties': QsciLexerProperties, 'Python': QsciLexerPython, 'Ruby': QsciLexerRuby,
                           'SQL': QsciLexerSQL, 'TCL': QsciLexerTCL, 'TeX': QsciLexerTeX,
                           'VHDL': QsciLexerVHDL, 'YAML': QsciLexerYAML, 'Plain': QsciLexerPython}

            if lexer:
                lex = self.lexers[lexer]()
                lex.setPaper(QColor(self.parent.config.options.qsci.bg_color))
                #lex.setColor(QColor(self.parent.config.options.qsci.fg_color))
                editor.setLexer(lex)

            editor.resetSelectionBackgroundColor()
            editor.resetSelectionForegroundColor()
            editor.setCaretLineBackgroundColor(QColor(self.parent.config.options.qsci.caretline_color))
            editor.setMarginsBackgroundColor(QColor(self.parent.config.options.qsci.margins_bg_color))
            editor.setMarginsForegroundColor(QColor(self.parent.config.options.qsci.margins_fg_color))
            editor.setFoldMarginColors(QColor(self.parent.config.options.qsci.foldmargin_prim_color),
                QColor(self.parent.config.options.qsci.foldmargin_sec_color))
            editor.setSelectionBackgroundColor(QColor(self.parent.config.options.qsci.selection_bg_color))
            editor.setSelectionForegroundColor(QColor(self.parent.config.options.qsci.selection_fg_color))
            editor.setFolding(self.parent.config.options.qsci.folding)
            editor.setPaper(QColor(self.parent.config.options.qsci.bg_color))
            editor.setColor(QColor(self.parent.config.options.qsci.fg_color))

            font = QFont()
            font.setFamily(self.parent.config.options.qsci.font)
            font.setFixedPitch(True)
            font.setPointSize(self.parent.config.options.qsci.font_size)
            fm = QFontMetrics(font)
            editor.setFont(font)
            if self.parent.config.options.qsci.linenumbers:
                editor.setMarginsFont(font)
                editor.setMarginWidth(0, fm.width("000") + 5)
                editor.setMarginLineNumbers(0, True)
            if self.parent.config.options.qsci.folding:
                editor.setFolding(QsciScintilla.BoxedTreeFoldStyle)
            editor.setBraceMatching(QsciScintilla.SloppyBraceMatch)
            editor.setCaretLineVisible(self.parent.config.options.qsci.caretline)
        else:
            editor = QTextEdit(self)

        self.editor = editor
        self.focused = editor
        lay.addWidget(editor)
        if filename:
            self.open(filename)

        self.setLayout(lay)

        if self.autosave:
            self.editor.focusOutEvent = self.focusOutEvent
Exemplo n.º 22
0
    def __init__(self, parent, filename='', lexer='', autosave=True):
        FocusProxy.__init__(self)
        WinterObject.__init__(self)
        self.QSCI_SUPPORT = QSCI_SUPPORT
        self.parent = parent
        self.autosave = autosave
        try:
            self.api = parent.API()
        except AttributeError:
            from .baseQt import API

            self.api = API()
        self.filename = filename
        lay = QVBoxLayout()
        self.tb = QToolBar(self)
        lay.addWidget(self.tb)

        self.tb_save = QToolButton()
        #        self.tb_save.setIcon(QIcon.fromTheme('document-save', QIcon(self.api.icons['filesave'])))
        #        self.connect(self.tb_save, SIGNAL("clicked()"), self.save)
        #        self.tb.addWidget(self.tb_save)

        if QSCI_SUPPORT:
            editor = QsciScintilla(self)
            editor.setUtf8(True)
            self.lexers = {
                'Bash': QsciLexerBash,
                'Batch': QsciLexerBatch,
                'CMake': QsciLexerCMake,
                'CPP': QsciLexerCPP,
                'CSS': QsciLexerCSS,
                'D': QsciLexerD,
                'Diff': QsciLexerDiff,
                'Fortran': QsciLexerFortran77,
                'HTML': QsciLexerHTML,
                'Lua': QsciLexerLua,
                'Make': QsciLexerMakefile,
                'Pascal': QsciLexerPascal,
                'Perl': QsciLexerPerl,
                'PostScript': QsciLexerPostScript,
                'POV': QsciLexerPOV,
                'Properties': QsciLexerProperties,
                'Python': QsciLexerPython,
                'Ruby': QsciLexerRuby,
                'SQL': QsciLexerSQL,
                'TCL': QsciLexerTCL,
                'TeX': QsciLexerTeX,
                'VHDL': QsciLexerVHDL,
                'YAML': QsciLexerYAML,
                'Plain': QsciLexerPython
            }

            if lexer:
                lex = self.lexers[lexer]()
                lex.setPaper(QColor(self.parent.config.options.qsci.bg_color))
                #lex.setColor(QColor(self.parent.config.options.qsci.fg_color))
                editor.setLexer(lex)

            editor.resetSelectionBackgroundColor()
            editor.resetSelectionForegroundColor()
            editor.setCaretLineBackgroundColor(
                QColor(self.parent.config.options.qsci.caretline_color))
            editor.setMarginsBackgroundColor(
                QColor(self.parent.config.options.qsci.margins_bg_color))
            editor.setMarginsForegroundColor(
                QColor(self.parent.config.options.qsci.margins_fg_color))
            editor.setFoldMarginColors(
                QColor(self.parent.config.options.qsci.foldmargin_prim_color),
                QColor(self.parent.config.options.qsci.foldmargin_sec_color))
            editor.setSelectionBackgroundColor(
                QColor(self.parent.config.options.qsci.selection_bg_color))
            editor.setSelectionForegroundColor(
                QColor(self.parent.config.options.qsci.selection_fg_color))
            editor.setFolding(self.parent.config.options.qsci.folding)
            editor.setPaper(QColor(self.parent.config.options.qsci.bg_color))
            editor.setColor(QColor(self.parent.config.options.qsci.fg_color))

            font = QFont()
            font.setFamily(self.parent.config.options.qsci.font)
            font.setFixedPitch(True)
            font.setPointSize(self.parent.config.options.qsci.font_size)
            fm = QFontMetrics(font)
            editor.setFont(font)
            if self.parent.config.options.qsci.linenumbers:
                editor.setMarginsFont(font)
                editor.setMarginWidth(0, fm.width("000") + 5)
                editor.setMarginLineNumbers(0, True)
            if self.parent.config.options.qsci.folding:
                editor.setFolding(QsciScintilla.BoxedTreeFoldStyle)
            editor.setBraceMatching(QsciScintilla.SloppyBraceMatch)
            editor.setCaretLineVisible(
                self.parent.config.options.qsci.caretline)
        else:
            editor = QTextEdit(self)

        self.editor = editor
        self.focused = editor
        lay.addWidget(editor)
        if filename:
            self.open(filename)

        self.setLayout(lay)

        if self.autosave:
            self.editor.focusOutEvent = self.focusOutEvent
Exemplo n.º 23
0
 def __init__(self, name, icon, doll):
     WinterObject.__init__(self)
     self.icon = icon
     self.item = None
     self.name = name
     self.doll = doll
Exemplo n.º 24
0
 def __init__(self, map):
     list.__init__(self)
     WinterObject.__init__(self)
     self.map = map
Exemplo n.º 25
0
 def __init__(self, name, icon, doll):
     WinterObject.__init__(self)
     self.icon = icon
     self.item = None
     self.name = name
     self.doll = doll