Typica is a free program for professional coffee roasters. https://typica.us
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

manuallogentry.xml 6.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <window id="manualLogEntry">
  2. <menu name="File">
  3. <plugins id="pluginMenu" title="Import" src="ImportFilters" preRun="pluginContext.preRun();" postRun="pluginContext.postRun();"/>
  4. <separator />
  5. <item id="quitItem" shortcut="ctrl+Q">Quit</item>
  6. </menu>
  7. <layout type="vertical">
  8. <tabbar id="tabs"/>
  9. <layout type="stack" id="pages">
  10. <page>
  11. <layout type="vertical">
  12. <layout type="horizontal">
  13. <label>Batch Type:</label>
  14. <sqldrop id="batchType" />
  15. <label>Machine:</label>
  16. <sqldrop id="machineSelector" />
  17. <stretch />
  18. </layout>
  19. <label>Green Coffee:</label>
  20. <layout type="stack" id="greenInfoLayout">
  21. <page id="sampleGreen">
  22. <layout type="vertical">
  23. <layout type="grid">
  24. <row>
  25. <column><label>Name:</label></column>
  26. <column><line id="sampleGreenName" /></column>
  27. </row>
  28. <row>
  29. <column><label>Weight:</label></column>
  30. <column><line id="sampleGreenWeight" /></column>
  31. <column><sqldrop id="sampleGreenUnit" /></column>
  32. </row>
  33. <row>
  34. <column><label>Vendor:</label></column>
  35. <column><line id="sampleGreenVendor" /></column>
  36. </row>
  37. <row>
  38. <column><label>Arrival Date:</label></column>
  39. <column><line id="sampleGreenArrivalDate" /></column>
  40. </row>
  41. </layout>
  42. <label>Additional Details:</label>
  43. <sqltablearray columns="2" id="attributes">
  44. <column name="Attribute" />
  45. <column name="Value" />
  46. </sqltablearray>
  47. </layout>
  48. </page>
  49. <page id="productionGreen">
  50. <layout type="vertical">
  51. <layout type="horizontal">
  52. <label>Unit:</label>
  53. <sqldrop id="productionGreenUnit" />
  54. <stretch />
  55. </layout>
  56. <sqltablearray columns="2" id="productionGreenTable">
  57. <column name="Coffee" delegate="sql" showdata="true" null="true" nulltext="Delete" nulldata="delete" data="0" display="1">
  58. <![CDATA[SELECT id, name FROM coffees WHERE quantity <> 0 ORDER BY name]]>
  59. </column>
  60. <column name="Weight" delegate="numeric" />
  61. </sqltablearray>
  62. </layout>
  63. </page>
  64. </layout>
  65. <label>Roasting Details:</label>
  66. <layout type="grid">
  67. <row>
  68. <column><label>Item:</label></column>
  69. <column>
  70. <sqldrop data="0" display="1" showdata="true" id="roastedItem">
  71. <null />
  72. <query>SELECT id, name FROM items WHERE category = 'Coffee: Roasted' AND id IN (SELECT item FROM current_items) ORDER BY name</query>
  73. </sqldrop>
  74. </column>
  75. </row>
  76. <row>
  77. <column><label>Weight:</label></column>
  78. <column><line id="roastedWeight" validator="numeric" /></column>
  79. </row>
  80. <row>
  81. <column><label>Time:</label></column>
  82. <column><calendar id="roastTime" time="true"/></column>
  83. </row>
  84. <row>
  85. <column><label>Duration:</label></column>
  86. <column><timeedit id="roastDuration" /></column>
  87. </row>
  88. <row>
  89. <column><label>Notes:</label></column>
  90. <column><textarea id="notes" /></column>
  91. </row>
  92. </layout>
  93. </layout>
  94. </page>
  95. <page>
  96. <layout type="vertical">
  97. <splitter type="horizontal" id="roastdatasplit">
  98. <measurementtable id="log" />
  99. <graph id="graph" />
  100. </splitter>
  101. </layout>
  102. </page>
  103. <page>
  104. </page>
  105. </layout>
  106. <layout type="horizontal">
  107. <stretch />
  108. <button name="Submit" id="submit" type="push" />
  109. </layout>
  110. </layout>
  111. <program>
  112. <![CDATA[
  113. var window = this;
  114. this.windowTitle = "Typica - Manual Log Entry";
  115. quitItem = findChildObject(this, 'quitItem');
  116. quitItem.triggered.connect(function() {
  117. Application.quit();
  118. });
  119. pluginContext = {};
  120. pluginContext.table = findChildObject(this, 'log');
  121. pluginContext.graph = findChildObject(this, 'graph');
  122. pluginContext.preRun = function() {
  123. var filename = QFileDialog.getOpenFileName(window, TTR("manualLogEntry", "Import"), QSettings.value('script/lastDir', '') + '/');
  124. var file = new QFile(filename);
  125. if(file.open(1)) {
  126. pluginContext.data = file.readToString();
  127. file.close();
  128. pluginContext.table.clear();
  129. pluginContext.graph.clear();
  130. QSettings.setValue("script/lastDir", dir(filename));
  131. } else {
  132. throw new Error("Failed to open file, aborting import.");
  133. }
  134. };
  135. pluginContext.postRun = function() {
  136. };
  137. pluginContext.newMeasurement = function(m, c) {
  138. pluginContext.table.newMeasurement(m, c);
  139. pluginContext.graph.newMeasurement(m, c);
  140. }
  141. pluginMenu = findChildObject(this, 'pluginMenu');
  142. pluginMenu.setProperty("activationObject", pluginContext);
  143. tabs = findChildObject(this, 'tabs');
  144. tabs.addTab("Batch Data");
  145. tabs.addTab("Roast Data");
  146. tabs.addTab("Roast Data Configuration");
  147. pages = findChildObject(this, 'pages');
  148. tabs.currentChanged.connect(function(index) {
  149. pages.setCurrentIndex(index);
  150. });
  151. greenInfoLayout = findChildObject(this, 'greenInfoLayout');
  152. roastedItem = findChildObject(this, 'roastedItem');
  153. batchType = findChildObject(this, 'batchType');
  154. batchType.addItem("Sample");
  155. batchType.addItem("Production");
  156. batchType['currentIndexChanged(int)'].connect(function(batchTypeIndex) {
  157. QSettings.setValue("script/manual_batchType", batchTypeIndex);
  158. greenInfoLayout.setCurrentIndex(batchTypeIndex);
  159. roastedItem.enabled = (batchTypeIndex == 1);
  160. });
  161. batchType.setCurrentIndex(QSettings.value("script/manual_batchType", 1));
  162. var machineSelector = findChildObject(this, 'machineSelector');
  163. var machineModel = new DeviceTreeModel;
  164. machineSelector.setModel(machineModel);
  165. machineSelector.currentIndex = QSettings.value("script/manualMachineSelection", 0);
  166. machineSelector['currentIndexChanged(int)'].connect(function(index) {
  167. QSettings.setValue("script/manualMachineSelection", index);
  168. });
  169. sampleGreenUnit = findChildObject(this, 'sampleGreenUnit');
  170. sampleGreenUnit.addItem("g");
  171. sampleGreenUnit.addItem("Kg");
  172. sampleGreenUnit.addItem("oz");
  173. sampleGreenUnit.addItem("lb");
  174. sampleGreenUnit.currentIndex = (QSettings.value("script/manual_unit", sampleGreenUnit.findText("lb")));
  175. productionGreenUnit = findChildObject(this, 'productionGreenUnit');
  176. productionGreenUnit.addItem("g");
  177. productionGreenUnit.addItem("Kg");
  178. productionGreenUnit.addItem("oz");
  179. productionGreenUnit.addItem("lb");
  180. productionGreenUnit.currentIndex = (QSettings.value("script/manual_unit", productionGreenUnit.findText("lb")));
  181. sampleGreenUnit['currentIndexChanged(int)'].connect(function(greenUnitIndex) {
  182. QSettings.setValue("script/manual_unit", greenUnitIndex);
  183. productionGreenUnit.setCurrentIndex(greenUnitIndex);
  184. });
  185. productionGreenUnit['currentIndexChanged(int)'].connect(function(greenUnitIndex) {
  186. QSettings.setValue("script/manual_unit", greenUnitIndex);
  187. sampleGreenUnit.setCurrentIndex(greenUnitIndex);
  188. });
  189. ]]>
  190. </program>
  191. </window>