Typica is a free program for professional coffee roasters. https://typica.us
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

importprofiles.xml 1.6KB

123456789101112131415161718192021222324252627282930313233343536
  1. <window id="importTargets">
  2. <layout type="horizontal">
  3. <sqldrop data="0" display="1" showdata="true" id="roasted">
  4. <query>SELECT id, name FROM items WHERE category = 'Coffee: Roasted' AND id IN (SELECT item FROM current_items) ORDER BY name</query>
  5. </sqldrop>
  6. <button name="File…" id="file" type="push" />
  7. </layout>
  8. <program>
  9. var button = findChildObject(this, 'file');
  10. var box = findChildObject(this, 'roasted');
  11. var win = this;
  12. button.clicked.connect(function() {
  13. var filename = QFileDialog.getOpenFileName(win, 'Open Log…', QSettings.value('script/lastDir', '') + '/');
  14. if(filename != '') {
  15. QSettings.setValue("script/lastDir", dir(filename));
  16. var q = "INSERT INTO files (id, name, type, note, file) VALUES(default, :name, 'profile', NULL, :data) RETURNING id";
  17. query = new QSqlQuery();
  18. query.prepare(q);
  19. query.bind(":name", baseName(filename));
  20. query.bindFileData(":data", filename);
  21. query.exec();
  22. query.next();
  23. var fileno = query.value(0);
  24. var id = box.currentData();
  25. q = "INSERT INTO item_files (time, item, files) VALUES('now', ";
  26. q = q + id;
  27. q = q + ", '{";
  28. q = q + fileno;
  29. q = q + "}')";
  30. query.exec(q);
  31. query = query.invalidate();
  32. var success = createWindow("success");
  33. }
  34. });
  35. </program>
  36. </window>