Exemplo n.º 1
0
def po2csv(po):
    """Converts a polib.POFile object to a csv string (contained in an instance
    of StringIO)
    """
    csv_file = StringIO()
    csv_writer = csv.writer(csv_file)

    for header_row in csv_header_rows:
        csv_writer.writerow(header_row)

    for entry in po:

        msgstrs = force_plurals(entry)
        fuzzy = bool2str('fuzzy' in entry.flags, empty_for_false=True)
        obsolete = bool2str(entry.obsolete, empty_for_false=True)

        row = [
            escape(entry.msgid),
            escape(entry.msgid_plural),
            entry.msgctxt,
            msgstrs,
            fuzzy,
            entry.comment,
            obsolete
        ]
        csv_writer.writerow(row)

    return csv_file
Exemplo n.º 2
0
 def showToolBar(self, toolbar, mode):
     if toolbar in self.toolBars.keys():
         tb = self.toolBars[toolbar]
         tb.setVisible(str2bool(mode))
         self.settings.initSetValue('visible', bool2str(mode), tb.key)
     else:
         for tb in self.toolBars.values():
             tb.setVisible(str2bool(mode))
             self.settings.iniSetValue('visible', bool2str(mode), tb.key)
Exemplo n.º 3
0
    def saveandclose_dialog(self, event):
        utils.add_user_attribute(delete_files_after_install,utils.bool2str(self.delete_after_unzip.GetValue()))
        mail = self.mail_field.GetValue()
        if len(mail) > 0:
            if not utils.is_valid_mail(mail):
                wx.MessageBox('Invalid format for mail address', 'Assembly Error',wx.OK | wx.ICON_WARNING)
                return

        if not utils.set_mail(self.uid, mail):
            wx.MessageBox('Unable to store mailaddress.', 'Assembly Error',wx.OK | wx.ICON_WARNING)
            return

        if len(mail) > 0:
            if self.notifications.IsChecked():
                if not utils.set_notifications(self.uid, True):
                    wx.MessageBox('Unable to activate notificationsetting.', 'Assembly Error',wx.OK | wx.ICON_WARNING)
                    return
            else:
                if not utils.set_notifications(self.uid, False):
                    wx.MessageBox('Unable to deactivate notificationsetting.', 'Assembly Error',wx.OK | wx.ICON_WARNING)
                    return

        self.Destroy()
Exemplo n.º 4
0
 def set_minimize_behavior(self, state):
     logger.debug('The minimize state is %s' % state)
     self.minimizeToTray = state
     self.settings.setValue("minimizeToTray", bool2str(state))