Skip to content
Snippets Groups Projects
  1. Oct 21, 2021
  2. Oct 15, 2021
  3. Oct 13, 2021
  4. Sep 20, 2021
    • Wuttke, Joachim's avatar
      Initialize item and item parameter tags in header files. · 2a33f913
      Wuttke, Joachim authored
      import edtools as et
      import re
      
      def user_edit_pair(fname_stem, th, tc):
      
          data = []
          mm = re.finditer('const QString (\w+)::([MPT]_[A-Z0-9_]+) = "(.+?)";', tc)
          for m in mm:
              data.append([m.group(1), m.group(2), m.group(3)])
          mm = re.finditer('const QString (\w+)::([MPT]_[A-Z0-9_]+)\("(.+?)"\);', tc)
          for m in mm:
              data.append([m.group(1), m.group(2), m.group(3)])
      
          for cname, typ, label in data:
              rlabel = re.sub(r'\[', r'\\[', label)
              rlabel = re.sub(r'\]', r'\\]', rlabel)
              rlabel = re.sub(r'\(', r'\\(', rlabel)
              rlabel = re.sub(r'\)', r'\\)', rlabel)
              tc = re.sub('\n+const QString '+cname+'::'+typ+' =\s+"'+rlabel+'";', '', tc)
              tc = re.sub('\n+const QString '+cname+'::'+typ+'\("'+rlabel+'"\);', '', tc)
              th = re.sub(r'class( BA_CORE_API_)? ('+cname+r'.+?)static const QString '+typ+r';(.*?\n};)',
                          r'class \2static constexpr auto '+typ+r'{"'+label+r'"};\3', th, 0, re.S)
      
          return th, tc
      
      et.ed_argfilepairs(user_edit_pair)
      2a33f913
  5. Aug 03, 2021
  6. Jul 09, 2021
  7. Jul 08, 2021
  8. May 07, 2021
  9. May 06, 2021
  10. May 05, 2021
  11. May 03, 2021
  12. Jan 20, 2021
  13. Dec 17, 2020
  14. Nov 20, 2020
  15. Nov 17, 2020
  16. Nov 15, 2020
  17. Oct 16, 2020
  18. Oct 14, 2020
  19. Jul 15, 2020
  20. Jul 06, 2020
  21. Jul 08, 2019
  22. Nov 27, 2018
  23. Dec 20, 2017
  24. Oct 05, 2017
  25. Oct 04, 2017
  26. Sep 25, 2017
Loading