コード例 #1
0
ファイル: topicinput.py プロジェクト: blackknifes/VNR-Core
    def refresh(self):
        scoreEnabled = self.topicType == 'review'
        self.scoreRow.setVisible(scoreEnabled)
        self.typeEdit.setVisible(not scoreEnabled)

        self.saveButton.setEnabled(False)

        self.contentEdit.setPlainText(self.topicContent)

        try:
            typeIndex = defs.TOPIC_TYPES.index(self.topicType)
        except ValueError:
            typeIndex = 0
        self.typeEdit.setCurrentIndex(typeIndex)

        try:
            langIndex = config.LANGUAGES.index(
                config.htmllocale2language(self.topicLanguage))
        except ValueError:
            langIndex = 1  # 'en'
        self.languageEdit.setCurrentIndex(langIndex)

        self.spellHighlighter.setLanguage(
            self.topicLanguage)  # must after lang

        self._refreshImage()
コード例 #2
0
 def getLangShortName(self, lang):
     """
 @param  lang  unicode
 @return  unicode
 """
     if not lang:
         return ''
     import config, i18n
     ret = config.htmllocale2language(lang)
     return i18n.language_name2(ret) or ret or lang
コード例 #3
0
ファイル: postinput.py プロジェクト: blackknifes/VNR-Core
    def refresh(self):
        self.saveButton.setEnabled(False)

        self.contentEdit.setPlainText(self.postContent)

        try:
            langIndex = config.LANGUAGES.index(
                config.htmllocale2language(self.postLanguage))
        except ValueError:
            langIndex = 1  # 'en'
        self.languageEdit.setCurrentIndex(langIndex)

        self.spellHighlighter.setLanguage(self.postLanguage)  # must after lang

        self._refreshImage()
コード例 #4
0
    def refresh(self):
        self.contentEdit.setPlainText(self.postContent)
        self.imageTitleEdit.setText(self.imageTitle)

        enabled = bool(self.imageId)
        self.removeImageButton.setVisible(enabled)
        self.imageTitleEdit.setVisible(enabled)

        try:
            langIndex = config.LANGUAGES.index(
                config.htmllocale2language(self.postLanguage))
        except ValueError:
            langIndex = 1  # 'en'
        self.languageEdit.setCurrentIndex(langIndex)

        self.spellHighlighter.setLanguage(self.postLanguage)  # must after lang

        for w in self._iterImageWidgets():
            w.setEnabled(self.imageEnabled)

        self.saveButton.setEnabled(False)
コード例 #5
0
  def refresh(self):
    self.titleEdit.setText(self.topicTitle)
    self.contentEdit.setPlainText(self.topicContent)
    self.imageTitleEdit.setText(self.imageTitle)

    enabled = bool(self.imageId)
    self.removeImageButton.setVisible(enabled)
    self.imageTitleEdit.setVisible(enabled)

    try: langIndex = config.LANGUAGES.index(config.htmllocale2language(self.topicLanguage))
    except ValueError: langIndex = 1 # 'en'
    self.languageEdit.setCurrentIndex(langIndex)

    if self.topicType != 'review':
      try: typeIndex = defs.TOPIC_TYPES.index(self.topicType)
      except ValueError: typeIndex = 0 # 'chat'
      self.typeEdit.setCurrentIndex(typeIndex)

    self.spellHighlighter.setLanguage(self.topicLanguage) # must after lang

    for w in self._iterImageWidgets():
      w.setEnabled(self.imageEnabled)

    scoreEdits = self.scoreEdits
    for v in scoreEdits.itervalues():
      v.setValue(0)

    scoreEnabled = self.topicType == 'review'
    self.scoreRow.setVisible(scoreEnabled)
    self.typeEdit.setVisible(not scoreEnabled)
    if scoreEnabled and self.scores:
      try:
        for k,v in self.scores.iteritems():
          w = scoreEdits.get(k)
          if w:
            w.setValue(v)
      except Exception, e:
        dwarn(e)