コード例 #1
0
    def addMenuContent(self, parent, desc, menuContents, box, messages,
                       additivesDict):
        self.addMenuLine(parent, desc, box)
        if desc in menuContents:
            contentList = menuContents[desc]
        else:
            contentList = [(messages[u'noContents'], None, [], None)]
            log_debug("lunch menu does not contain key '%s'" % desc)

        textview = GrowingTextEdit(parent, messages, additivesDict)
        textview.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        textview.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        textview.setLineWrapMode(QTextEdit.WidgetWidth)
        textview.setReadOnly(True)
        textview.document().setIndentWidth(10)

        if len(contentList) == 1:
            title, description, additives, keyInfo = contentList[0]
            textview.append(
                self.formatTitleAndDescription(title, description, keyInfo),
                additives)
        elif len(contentList) > 1:
            cursor = textview.textCursor()
            listFormat = QTextListFormat()
            listFormat.setStyle(QTextListFormat.ListDisc)
            listFormat.setIndent(1)
            cursor.createList(listFormat)
            for title, description, additives, keyInfo in contentList:
                textview.append(
                    self.formatTitleAndDescription(title, description,
                                                   keyInfo), additives)

        box.addWidget(textview, 0)
コード例 #2
0
 def addMenuContent(self, parent, desc, menuContents, box, messages, additivesDict):
     self.addMenuLine(parent, desc, box)
     if desc in menuContents:
         contentList = menuContents[desc]
     else:
         contentList = [(messages[u'noContents'], None, [], None)]
         log_debug("lunch menu does not contain key '%s'" % desc)
     
     textview = GrowingTextEdit(parent, messages, additivesDict)
     textview.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
     textview.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
     textview.setLineWrapMode(QTextEdit.WidgetWidth)
     textview.setReadOnly(True)
     textview.document().setIndentWidth(10)
     
     if len(contentList) == 1:
         title, description, additives, keyInfo = contentList[0]
         textview.append(self.formatTitleAndDescription(title, description, keyInfo), additives)
     elif len(contentList) > 1:
         cursor = textview.textCursor()
         listFormat = QTextListFormat()
         listFormat.setStyle(QTextListFormat.ListDisc)
         listFormat.setIndent(1)
         cursor.createList(listFormat)
         for title, description, additives, keyInfo in contentList:
             textview.append(self.formatTitleAndDescription(title, description, keyInfo), additives)
     
     box.addWidget(textview, 0)
コード例 #3
0
 def lastUpdateForLunchDay(self, date, tableName):
     sql="SELECT LAST_UPDATE FROM %s WHERE DATE=%s" % (self.get_table_name(tableName), self.get_formatted_date(date))
     tuples = self.query(sql)
     if tuples == None or len(tuples) == 0:
         log_debug("%s -> None" % sql)
         return None
     else:
         log_debug("%s -> %s" % (sql, tuples))
         return self.parse_result_date(tuples[0][0])
コード例 #4
0
 def insertLunchPart(self, date, textAndAdditivesList, update, table):
     sql=None
     if update:
         sql="DELETE FROM %s WHERE DATE=%s" % (self.get_table_name(table), self.get_formatted_date(date))
         log_debug(sql)
         self.executeNoCommit(sql)
     for textAndAdditives in textAndAdditivesList:
         sql="INSERT INTO %s VALUES(%s, ?, ?, %s)" % (self.get_table_name(table), self.get_formatted_date(date), self.get_formatted_date(date.today()))
         log_debug("%s, %s, %s" % (sql, textAndAdditives[0], textAndAdditives[1]))
         self.executeNoCommit(sql, textAndAdditives[0], textAndAdditives[1])            
コード例 #5
0
 def process_event(self, cmd, value, ip, member_info, preprocessedData=None):
     if self.launcher:
         if cmd == "HELO_USBROCKET":
             try:
                 if value=="FIRE":
                     self.launcher.stop_movement()
                     self.launcher.start_movement(4)
                 else:
                     self.launcher.start_movement(self.number_map.index(value))
                     Timer(0.5, self.launcher.stop_movement).start()
             except ValueError as e:
                 log_debug("USB Rocket: Command value unknown: ", value)
コード例 #6
0
 def update_reports(self):
     self.refresh_btn.setEnabled(False)
     repoUser = self.mt.options[u"repo_user"]
     repoName = self.mt.options[u"repo_name"]
     if repoUser and repoName:
         log_debug("Fetching issues from repository %s/%s" % (repoUser, repoName))
         thread = DownloadThread(self, "https://api.github.com/repos/%s/%s/issues?state=open" % (repoUser, repoName))
         thread.finished.connect(thread.deleteLater)
         thread.error.connect(self.errorDownloadingIssues)
         thread.success.connect(self.downloadedIssues)
         thread.start()
     else:
         log_warning("No Lunchinator GitHub repository specified.")
コード例 #7
0
 def process_event(self,
                   cmd,
                   value,
                   ip,
                   member_info,
                   preprocessedData=None):
     if self.launcher:
         if cmd == "HELO_USBROCKET":
             try:
                 if value == "FIRE":
                     self.launcher.stop_movement()
                     self.launcher.start_movement(4)
                 else:
                     self.launcher.start_movement(
                         self.number_map.index(value))
                     Timer(0.5, self.launcher.stop_movement).start()
             except ValueError as e:
                 log_debug("USB Rocket: Command value unknown: ", value)