ENH:add humidity display/surplus material
Change-Id: I1a04df257c9b09fef7ff06cfa192644478a30716
This commit is contained in:
parent
3a9397307d
commit
3925ceb9f4
9 changed files with 218 additions and 31 deletions
11
resources/images/ams_humidity_0.svg
Normal file
11
resources/images/ams_humidity_0.svg
Normal file
|
@ -0,0 +1,11 @@
|
|||
<svg width="20" height="18" viewBox="0 0 20 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M9.08751 10.1311L9.30206 10.5827L9.58751 10.4471V10.1311H9.08751ZM12.3733 10.1311H11.8733V10.4471L12.1588 10.5827L12.3733 10.1311ZM9.58751 2.64291C9.58751 2.0117 10.0992 1.5 10.7304 1.5V0.5C9.54692 0.5 8.58751 1.45941 8.58751 2.64291H9.58751ZM9.58751 10.1311V2.64291H8.58751V10.1311H9.58751ZM7.39697 13.5956C7.39697 12.2666 8.17469 11.1182 9.30206 10.5827L8.87297 9.67943C7.41008 10.3744 6.39697 11.8662 6.39697 13.5956H7.39697ZM10.7304 16.929C8.88941 16.929 7.39697 15.4366 7.39697 13.5956H6.39697C6.39697 15.9889 8.33712 17.929 10.7304 17.929V16.929ZM14.0639 13.5956C14.0639 15.4366 12.5714 16.929 10.7304 16.929V17.929C13.1237 17.929 15.0639 15.9889 15.0639 13.5956H14.0639ZM12.1588 10.5827C13.2861 11.1182 14.0639 12.2666 14.0639 13.5956H15.0639C15.0639 11.8662 14.0508 10.3744 12.5879 9.67943L12.1588 10.5827ZM11.8733 2.6429V10.1311H12.8733V2.6429H11.8733ZM10.7304 1.5C11.3616 1.5 11.8733 2.0117 11.8733 2.6429H12.8733C12.8733 1.45941 11.9139 0.5 10.7304 0.5V1.5Z" fill="#898989"/>
|
||||
<path d="M1 9.03081C1 7.79861 2.76767 3.86325 3.28007 3.86328C3.79246 3.86331 5.48331 7.97448 5.48331 9.03081C5.48331 10.0871 4.81114 11.549 3.28007 11.549C1.74899 11.549 1 10.263 1 9.03081Z" stroke="#898989"/>
|
||||
<path d="M2.46231 8.4037C2.3916 8.79641 2.43422 9.68152 3.17033 10.0803" stroke="#898989" stroke-linecap="round"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.2763 11.4742C12.2211 11.7174 12.9192 12.5751 12.9192 13.5958C12.9192 14.8056 11.9384 15.7863 10.7286 15.7863C9.51882 15.7863 8.53809 14.8056 8.53809 13.5958C8.53809 12.5751 9.2362 11.7174 10.181 11.4742L10.181 3.1907C10.181 2.88825 10.4262 2.64307 10.7286 2.64307C11.0311 2.64307 11.2763 2.88825 11.2763 3.1907L11.2763 11.4742Z" fill="#00AE42"/>
|
||||
<path d="M19.1211 15.7861H16.4358" stroke="#898989" stroke-linecap="round"/>
|
||||
<path d="M19.1211 12.5005H16.8833" stroke="#898989" stroke-linecap="round"/>
|
||||
<path d="M19.1211 9.21436L15.9882 9.21436" stroke="#898989" stroke-linecap="round"/>
|
||||
<path d="M19.1211 5.92871L15.9882 5.92871" stroke="#898989" stroke-linecap="round"/>
|
||||
<path d="M19.1211 2.64307H15.9882" stroke="#898989" stroke-linecap="round"/>
|
||||
</svg>
|
After Width: | Height: | Size: 2.2 KiB |
12
resources/images/ams_humidity_1.svg
Normal file
12
resources/images/ams_humidity_1.svg
Normal file
|
@ -0,0 +1,12 @@
|
|||
<svg width="20" height="18" viewBox="0 0 20 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M8.75548 10.1311L8.97003 10.5827L9.25548 10.4471V10.1311H8.75548ZM12.0413 10.1311H11.5413V10.4471L11.8267 10.5827L12.0413 10.1311ZM9.25548 2.64291C9.25548 2.0117 9.76718 1.5 10.3984 1.5V0.5C9.21489 0.5 8.25548 1.45941 8.25548 2.64291H9.25548ZM9.25548 10.1311V2.64291H8.25548V10.1311H9.25548ZM7.06494 13.5956C7.06494 12.2666 7.84266 11.1182 8.97003 10.5827L8.54093 9.67943C7.07804 10.3744 6.06494 11.8662 6.06494 13.5956H7.06494ZM10.3984 16.929C8.55737 16.929 7.06494 15.4366 7.06494 13.5956H6.06494C6.06494 15.9889 8.00509 17.929 10.3984 17.929V16.929ZM13.7318 13.5956C13.7318 15.4366 12.2394 16.929 10.3984 16.929V17.929C12.7917 17.929 14.7318 15.9889 14.7318 13.5956H13.7318ZM11.8267 10.5827C12.9541 11.1182 13.7318 12.2666 13.7318 13.5956H14.7318C14.7318 11.8662 13.7187 10.3744 12.2558 9.67943L11.8267 10.5827ZM11.5413 2.6429V10.1311H12.5413V2.6429H11.5413ZM10.3984 1.5C11.0296 1.5 11.5413 2.0117 11.5413 2.6429H12.5413C12.5413 1.45941 11.5819 0.5 10.3984 0.5V1.5Z" fill="#898989"/>
|
||||
<path d="M0.667969 9.03081C0.667969 7.79861 2.43564 3.86325 2.94804 3.86328C3.46043 3.86331 5.15128 7.97448 5.15128 9.03081C5.15128 10.0871 4.47911 11.549 2.94804 11.549C1.41696 11.549 0.667969 10.263 0.667969 9.03081Z" stroke="#898989"/>
|
||||
<path d="M2.13028 8.4037C2.05957 8.79641 2.10218 9.68152 2.8383 10.0803" stroke="#898989" stroke-linecap="round"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.9437 11.4742C11.8885 11.7174 12.5866 12.5751 12.5866 13.5958C12.5866 14.8056 11.6059 15.7863 10.3961 15.7863C9.1863 15.7863 8.20557 14.8056 8.20557 13.5958C8.20557 12.5751 8.90368 11.7174 9.84847 11.4742L9.84847 3.1907C9.84847 2.88825 10.0937 2.64307 10.3961 2.64307C10.6986 2.64307 10.9437 2.88825 10.9437 3.1907L10.9437 11.4742Z" fill="#C2C2C2"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.9437 11.4743C11.8885 11.7174 12.5866 12.5751 12.5866 13.5958C12.5866 14.8056 11.6059 15.7863 10.3961 15.7863C9.1863 15.7863 8.20557 14.8056 8.20557 13.5958C8.20557 12.5751 8.90368 11.7174 9.84847 11.4743L9.84847 6.11599C9.84847 5.81354 10.0937 5.56836 10.3961 5.56836C10.6986 5.56836 10.9437 5.81354 10.9437 6.11599L10.9437 11.4743Z" fill="#00AE42"/>
|
||||
<path d="M18.7876 15.7861H16.1023" stroke="#898989" stroke-linecap="round"/>
|
||||
<path d="M18.7876 12.5005H16.5498" stroke="#898989" stroke-linecap="round"/>
|
||||
<path d="M18.7876 9.21436L15.6547 9.21436" stroke="#898989" stroke-linecap="round"/>
|
||||
<path d="M18.7876 5.92871L15.6547 5.92871" stroke="#898989" stroke-linecap="round"/>
|
||||
<path d="M18.7876 2.64307H15.6547" stroke="#C2C2C2" stroke-linecap="round"/>
|
||||
</svg>
|
After Width: | Height: | Size: 2.6 KiB |
12
resources/images/ams_humidity_2.svg
Normal file
12
resources/images/ams_humidity_2.svg
Normal file
|
@ -0,0 +1,12 @@
|
|||
<svg width="20" height="18" viewBox="0 0 20 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M9.42345 10.1311L9.638 10.5827L9.92345 10.4471V10.1311H9.42345ZM12.7093 10.1311H12.2093V10.4471L12.4947 10.5827L12.7093 10.1311ZM9.92345 2.64291C9.92345 2.0117 10.4351 1.5 11.0664 1.5V0.5C9.88286 0.5 8.92345 1.45941 8.92345 2.64291H9.92345ZM9.92345 10.1311V2.64291H8.92345V10.1311H9.92345ZM7.73291 13.5956C7.73291 12.2666 8.51063 11.1182 9.638 10.5827L9.2089 9.67943C7.74601 10.3744 6.73291 11.8662 6.73291 13.5956H7.73291ZM11.0664 16.929C9.22534 16.929 7.73291 15.4366 7.73291 13.5956H6.73291C6.73291 15.9889 8.67306 17.929 11.0664 17.929V16.929ZM14.3998 13.5956C14.3998 15.4366 12.9074 16.929 11.0664 16.929V17.929C13.4596 17.929 15.3998 15.9889 15.3998 13.5956H14.3998ZM12.4947 10.5827C13.6221 11.1182 14.3998 12.2666 14.3998 13.5956H15.3998C15.3998 11.8662 14.3867 10.3744 12.9238 9.67943L12.4947 10.5827ZM12.2093 2.6429V10.1311H13.2093V2.6429H12.2093ZM11.0664 1.5C11.6976 1.5 12.2093 2.0117 12.2093 2.6429H13.2093C13.2093 1.45941 12.2498 0.5 11.0664 0.5V1.5Z" fill="#898989"/>
|
||||
<path d="M1.33594 9.03081C1.33594 7.79861 3.10361 3.86325 3.616 3.86328C4.1284 3.86331 5.81925 7.97448 5.81925 9.03081C5.81925 10.0871 5.14708 11.549 3.616 11.549C2.08493 11.549 1.33594 10.263 1.33594 9.03081Z" stroke="#898989"/>
|
||||
<path d="M2.79824 8.4037C2.72754 8.79641 2.77015 9.68152 3.50627 10.0803" stroke="#898989" stroke-linecap="round"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.6161 11.4742C12.5609 11.7174 13.259 12.5751 13.259 13.5958C13.259 14.8056 12.2783 15.7863 11.0685 15.7863C9.85867 15.7863 8.87793 14.8056 8.87793 13.5958C8.87793 12.5751 9.57604 11.7174 10.5208 11.4742L10.5208 3.1907C10.5208 2.88825 10.766 2.64307 11.0685 2.64307C11.3709 2.64307 11.6161 2.88825 11.6161 3.1907L11.6161 11.4742Z" fill="#C2C2C2"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.5208 11.4738L10.5208 9.31668C10.5208 9.01423 10.766 8.76904 11.0685 8.76904C11.3709 8.76904 11.6161 9.01423 11.6161 9.31668L11.6161 11.4738C12.5609 11.717 13.259 12.5747 13.259 13.5954C13.259 14.8052 12.2783 15.7859 11.0685 15.7859C9.85867 15.7859 8.87793 14.8052 8.87793 13.5954C8.87793 12.5747 9.57604 11.717 10.5208 11.4738Z" fill="#00AE42"/>
|
||||
<path d="M19.4609 15.7861H16.7756" stroke="#898989" stroke-linecap="round"/>
|
||||
<path d="M19.4609 12.5005H17.2232" stroke="#898989" stroke-linecap="round"/>
|
||||
<path d="M19.4609 9.21436L16.3281 9.21436" stroke="#898989" stroke-linecap="round"/>
|
||||
<path d="M19.4609 5.92871L16.3281 5.92871" stroke="#C2C2C2" stroke-linecap="round"/>
|
||||
<path d="M19.4609 2.64307H16.3281" stroke="#C2C2C2" stroke-linecap="round"/>
|
||||
</svg>
|
After Width: | Height: | Size: 2.6 KiB |
12
resources/images/ams_humidity_3.svg
Normal file
12
resources/images/ams_humidity_3.svg
Normal file
|
@ -0,0 +1,12 @@
|
|||
<svg width="20" height="18" viewBox="0 0 20 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M9.06407 10.1311L9.27862 10.5827L9.56407 10.4471V10.1311H9.06407ZM12.3499 10.1311H11.8499V10.4471L12.1353 10.5827L12.3499 10.1311ZM9.56407 2.64291C9.56407 2.0117 10.0758 1.5 10.707 1.5V0.5C9.52348 0.5 8.56407 1.45941 8.56407 2.64291H9.56407ZM9.56407 10.1311V2.64291H8.56407V10.1311H9.56407ZM7.37354 13.5956C7.37354 12.2666 8.15126 11.1182 9.27862 10.5827L8.84953 9.67943C7.38664 10.3744 6.37354 11.8662 6.37354 13.5956H7.37354ZM10.707 16.929C8.86597 16.929 7.37354 15.4366 7.37354 13.5956H6.37354C6.37354 15.9889 8.31368 17.929 10.707 17.929V16.929ZM14.0404 13.5956C14.0404 15.4366 12.548 16.929 10.707 16.929V17.929C13.1003 17.929 15.0404 15.9889 15.0404 13.5956H14.0404ZM12.1353 10.5827C13.2627 11.1182 14.0404 12.2666 14.0404 13.5956H15.0404C15.0404 11.8662 14.0273 10.3744 12.5644 9.67943L12.1353 10.5827ZM11.8499 2.64291V10.1311H12.8499V2.64291H11.8499ZM10.707 1.5C11.3382 1.5 11.8499 2.0117 11.8499 2.64291H12.8499C12.8499 1.45941 11.8905 0.5 10.707 0.5V1.5Z" fill="#898989"/>
|
||||
<path d="M0.976562 9.03081C0.976562 7.79861 2.74423 3.86325 3.25663 3.86328C3.76903 3.86331 5.45988 7.97448 5.45988 9.03081C5.45988 10.0871 4.78771 11.549 3.25663 11.549C1.72555 11.549 0.976562 10.263 0.976562 9.03081Z" stroke="#898989"/>
|
||||
<path d="M2.43887 8.4037C2.36816 8.79641 2.41078 9.68152 3.14689 10.0803" stroke="#898989" stroke-linecap="round"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.2528 11.4742C12.1976 11.7174 12.8957 12.5751 12.8957 13.5958C12.8957 14.8056 11.915 15.7863 10.7052 15.7863C9.49539 15.7863 8.51465 14.8056 8.51465 13.5958C8.51465 12.5751 9.21276 11.7174 10.1576 11.4742L10.1576 3.1907C10.1576 2.88825 10.4027 2.64307 10.7052 2.64307C11.0076 2.64307 11.2528 2.88825 11.2528 3.1907L11.2528 11.4742Z" fill="#C2C2C2"/>
|
||||
<path d="M12.8957 13.5958C12.8957 14.8056 11.915 15.7864 10.7052 15.7864C9.49539 15.7864 8.51465 14.8056 8.51465 13.5958C8.51465 12.386 9.49539 11.4053 10.7052 11.4053C11.915 11.4053 12.8957 12.386 12.8957 13.5958Z" fill="#FF6F00"/>
|
||||
<path d="M19.1001 15.7861H16.4148" stroke="#898989" stroke-linecap="round"/>
|
||||
<path d="M19.1001 12.5005H16.8623" stroke="#898989" stroke-linecap="round"/>
|
||||
<path d="M19.1001 9.21436L15.9672 9.21436" stroke="#C2C2C2" stroke-linecap="round"/>
|
||||
<path d="M19.1001 5.92871L15.9672 5.92871" stroke="#C2C2C2" stroke-linecap="round"/>
|
||||
<path d="M19.1001 2.64307H15.9672" stroke="#C2C2C2" stroke-linecap="round"/>
|
||||
</svg>
|
After Width: | Height: | Size: 2.4 KiB |
12
resources/images/ams_humidity_4.svg
Normal file
12
resources/images/ams_humidity_4.svg
Normal file
|
@ -0,0 +1,12 @@
|
|||
<svg width="21" height="18" viewBox="0 0 21 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M9.48155 10.1311L9.6961 10.5827L9.98155 10.4471V10.1311H9.48155ZM12.7674 10.1311H12.2674V10.4471L12.5528 10.5827L12.7674 10.1311ZM9.98155 2.64291C9.98155 2.0117 10.4933 1.5 11.1245 1.5V0.5C9.94097 0.5 8.98155 1.45941 8.98155 2.64291H9.98155ZM9.98155 10.1311V2.64291H8.98155V10.1311H9.98155ZM7.79102 13.5956C7.79102 12.2666 8.56874 11.1182 9.6961 10.5827L9.26701 9.67943C7.80412 10.3744 6.79102 11.8662 6.79102 13.5956H7.79102ZM11.1245 16.929C9.28345 16.929 7.79102 15.4366 7.79102 13.5956H6.79102C6.79102 15.9889 8.73116 17.929 11.1245 17.929V16.929ZM14.4579 13.5956C14.4579 15.4366 12.9655 16.929 11.1245 16.929V17.929C13.5178 17.929 15.4579 15.9889 15.4579 13.5956H14.4579ZM12.5528 10.5827C13.6802 11.1182 14.4579 12.2666 14.4579 13.5956H15.4579C15.4579 11.8662 14.4448 10.3744 12.9819 9.67943L12.5528 10.5827ZM12.2674 2.6429V10.1311H13.2674V2.6429H12.2674ZM11.1245 1.5C11.7557 1.5 12.2674 2.0117 12.2674 2.6429H13.2674C13.2674 1.45941 12.308 0.5 11.1245 0.5V1.5Z" fill="#898989"/>
|
||||
<path d="M1.39453 9.03081C1.39453 7.79861 3.1622 3.86325 3.6746 3.86328C4.18699 3.86331 5.87785 7.97448 5.87785 9.03081C5.87785 10.0871 5.20568 11.549 3.6746 11.549C2.14352 11.549 1.39453 10.263 1.39453 9.03081Z" stroke="#898989"/>
|
||||
<path d="M2.85684 8.4037C2.78613 8.79641 2.82875 9.68152 3.56486 10.0803" stroke="#898989" stroke-linecap="round"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.6708 11.4742C12.6156 11.7174 13.3137 12.5751 13.3137 13.5958C13.3137 14.8056 12.333 15.7863 11.1232 15.7863C9.91336 15.7863 8.93262 14.8056 8.93262 13.5958C8.93262 12.5751 9.63073 11.7174 10.5755 11.4742L10.5755 3.1907C10.5755 2.88825 10.8207 2.64307 11.1232 2.64307C11.4256 2.64307 11.6708 2.88825 11.6708 3.1907L11.6708 11.4742Z" fill="#C2C2C2"/>
|
||||
<path d="M13.3137 13.5955C13.3137 14.8053 12.333 15.7861 11.1232 15.7861C9.91335 15.7861 8.93262 14.8053 8.93262 13.5955C8.93262 13.1672 9.58139 13.869 10.7912 13.869C12.001 13.869 13.3137 12.3857 13.3137 13.5955Z" fill="#FF6F00"/>
|
||||
<path d="M19.5156 15.7861H16.8303" stroke="#898989" stroke-linecap="round"/>
|
||||
<path d="M19.5156 12.5005H17.2779" stroke="#C2C2C2" stroke-linecap="round"/>
|
||||
<path d="M19.5156 9.21436L16.3828 9.21436" stroke="#C2C2C2" stroke-linecap="round"/>
|
||||
<path d="M19.5156 5.92871L16.3828 5.92871" stroke="#C2C2C2" stroke-linecap="round"/>
|
||||
<path d="M19.5156 2.64307H16.3828" stroke="#C2C2C2" stroke-linecap="round"/>
|
||||
</svg>
|
After Width: | Height: | Size: 2.4 KiB |
|
@ -334,7 +334,7 @@ MachineObject::MachineObject(NetworkAgent* agent, std::string name, std::string
|
|||
ams_insert_flag = false;
|
||||
ams_power_on_flag = false;
|
||||
ams_support_use_ams = false;
|
||||
ams_humidity = -1;
|
||||
ams_humidity = 5;
|
||||
|
||||
/* signals */
|
||||
wifi_signal = "";
|
||||
|
@ -2531,6 +2531,18 @@ int MachineObject::parse_json(std::string payload)
|
|||
}
|
||||
if (!curr_ams) continue;
|
||||
|
||||
if (it->contains("humidity")) {
|
||||
std::string humidity = (*it)["humidity"].get<std::string>();
|
||||
|
||||
try {
|
||||
curr_ams->humidity = atoi(humidity.c_str());
|
||||
}
|
||||
catch (...) {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (it->contains("tray")) {
|
||||
std::set<std::string> tray_id_set;
|
||||
for (auto it = curr_ams->trayList.begin(); it != curr_ams->trayList.end(); it++) {
|
||||
|
|
|
@ -210,6 +210,7 @@ public:
|
|||
id = ams_id;
|
||||
}
|
||||
std::string id;
|
||||
int humidity = 5;
|
||||
bool startup_read_opt{true};
|
||||
bool tray_read_opt{false};
|
||||
bool is_exists{false};
|
||||
|
|
|
@ -58,6 +58,7 @@ bool AMSinfo::parse_ams_info(Ams *ams)
|
|||
{
|
||||
if (!ams) return false;
|
||||
this->ams_id = ams->id;
|
||||
this->ams_humidity = ams->humidity;
|
||||
cans.clear();
|
||||
for (int i = 0; i < 4; i++) {
|
||||
auto it = ams->trayList.find(std::to_string(i));
|
||||
|
@ -79,6 +80,9 @@ bool AMSinfo::parse_ams_info(Ams *ams)
|
|||
} else {
|
||||
info.material_state = AMSCanType::AMS_CAN_TYPE_THIRDBRAND;
|
||||
}
|
||||
|
||||
info.material_remain = it->second->remain < 0 ? 100 :it->second->remain;
|
||||
|
||||
} else {
|
||||
info.can_id = it->second->id;
|
||||
info.material_name = "";
|
||||
|
@ -521,6 +525,10 @@ void AMSLib::render(wxDC &dc)
|
|||
temp_text_colour = AMS_CONTROL_GRAY800;
|
||||
}
|
||||
|
||||
if (m_info.material_remain < 50) {
|
||||
temp_text_colour = AMS_CONTROL_GRAY800;
|
||||
}
|
||||
|
||||
//if (!wxWindow::IsEnabled()) {
|
||||
//temp_text_colour = AMS_CONTROL_DISABLE_TEXT_COLOUR;
|
||||
//}
|
||||
|
@ -568,11 +576,16 @@ void AMSLib::render(wxDC &dc)
|
|||
|
||||
void AMSLib::doRender(wxDC &dc)
|
||||
{
|
||||
wxSize size = GetSize();
|
||||
auto tmp_lib_colour = m_info.material_colour;
|
||||
wxSize size = GetSize();
|
||||
auto tmp_lib_colour = m_info.material_colour;
|
||||
auto temp_bitmap_third = m_bitmap_editable_light;
|
||||
auto temp_bitmap_brand = m_bitmap_readonly_light;
|
||||
|
||||
//draw def background
|
||||
dc.SetPen(wxPen(*wxTRANSPARENT_PEN));
|
||||
dc.SetBrush(wxBrush(AMS_CONTROL_DEF_LIB_BK_COLOUR));
|
||||
dc.DrawRoundedRectangle(FromDIP(4), FromDIP(4), size.x - FromDIP(8), size.y - FromDIP(8), m_radius);
|
||||
|
||||
if (tmp_lib_colour.GetLuminance() < 0.5) {
|
||||
temp_bitmap_third = m_bitmap_editable_light;
|
||||
temp_bitmap_brand = m_bitmap_readonly_light;
|
||||
|
@ -581,6 +594,11 @@ void AMSLib::doRender(wxDC &dc)
|
|||
temp_bitmap_brand = m_bitmap_readonly;
|
||||
}
|
||||
|
||||
if (m_info.material_remain < 50) {
|
||||
temp_bitmap_third = m_bitmap_editable;
|
||||
temp_bitmap_brand = m_bitmap_readonly;
|
||||
}
|
||||
|
||||
//if (!wxWindow::IsEnabled()) {
|
||||
//tmp_lib_colour = AMS_CONTROL_DISABLE_COLOUR;
|
||||
//}
|
||||
|
@ -598,11 +616,11 @@ void AMSLib::doRender(wxDC &dc)
|
|||
|
||||
dc.SetPen(wxPen(*wxTRANSPARENT_PEN));
|
||||
dc.SetBrush(wxBrush(tmp_lib_colour));
|
||||
if (m_radius == 0) {
|
||||
dc.DrawRectangle(0, 0, size.x, size.y);
|
||||
} else {
|
||||
dc.DrawRoundedRectangle(FromDIP(4), FromDIP(4), size.x - FromDIP(8), size.y - FromDIP(8), m_radius);
|
||||
}
|
||||
/* if (m_radius == 0) {
|
||||
dc.DrawRectangle(0, 0, size.x, size.y);
|
||||
} else {
|
||||
dc.DrawRoundedRectangle(FromDIP(4), FromDIP(4), size.x - FromDIP(8), size.y - FromDIP(8), m_radius);
|
||||
}*/
|
||||
}
|
||||
|
||||
if (!m_selected && m_hover) {
|
||||
|
@ -610,26 +628,54 @@ void AMSLib::doRender(wxDC &dc)
|
|||
dc.SetBrush(wxBrush(*wxTRANSPARENT_BRUSH));
|
||||
if (m_radius == 0) {
|
||||
dc.DrawRectangle(0, 0, size.x, size.y);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
dc.DrawRoundedRectangle(FromDIP(1), FromDIP(1), size.x - FromDIP(1), size.y - FromDIP(1), m_radius);
|
||||
}
|
||||
|
||||
dc.SetPen(wxPen(*wxTRANSPARENT_PEN));
|
||||
dc.SetBrush(wxBrush(tmp_lib_colour));
|
||||
if (m_radius == 0) {
|
||||
/* if (m_radius == 0) {
|
||||
dc.DrawRectangle(0, 0, size.x, size.y);
|
||||
} else {
|
||||
dc.DrawRoundedRectangle(FromDIP(4), FromDIP(4), size.x - FromDIP(8), size.y - FromDIP(8), m_radius);
|
||||
}
|
||||
}*/
|
||||
} else {
|
||||
dc.SetPen(wxPen(tmp_lib_colour, 1, wxSOLID));
|
||||
dc.SetBrush(wxBrush(tmp_lib_colour));
|
||||
if (m_radius == 0) {
|
||||
/*if (m_radius == 0) {
|
||||
dc.DrawRectangle(0, 0, size.x, size.y);
|
||||
} else {
|
||||
dc.DrawRoundedRectangle(FromDIP(4), FromDIP(4), size.x - FromDIP(8), size.y - FromDIP(8), m_radius);
|
||||
}*/
|
||||
}
|
||||
|
||||
//draw remain
|
||||
int height = size.y - FromDIP(8);
|
||||
int curr_height = height * float(m_info.material_remain * 1.0 / 100.0);
|
||||
|
||||
if (curr_height < FromDIP(6)) {
|
||||
curr_height = FromDIP(6);
|
||||
}
|
||||
|
||||
int top = height - curr_height;
|
||||
dc.DrawRoundedRectangle(FromDIP(4), FromDIP(4) + top, size.x - FromDIP(8), curr_height, m_radius);
|
||||
|
||||
if (top > 2) {
|
||||
dc.DrawRectangle(FromDIP(4), FromDIP(4) + top, size.x - FromDIP(8), FromDIP(2));
|
||||
if (tmp_lib_colour.Red() > 238 && tmp_lib_colour.Green() > 238 && tmp_lib_colour.Blue() > 238) {
|
||||
dc.SetPen(wxPen(wxColour(130, 129, 128), 1, wxSOLID));
|
||||
dc.SetBrush(wxBrush(*wxTRANSPARENT_BRUSH));
|
||||
dc.DrawLine(FromDIP(4), FromDIP(4) + top, size.x - FromDIP(4), FromDIP(4) + top);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//border
|
||||
dc.SetPen(wxPen(wxColour(130, 130, 128), 1, wxSOLID));
|
||||
dc.SetBrush(wxBrush(*wxTRANSPARENT_BRUSH));
|
||||
dc.DrawRoundedRectangle(FromDIP(4), FromDIP(4), size.x - FromDIP(8), size.y - FromDIP(8), m_radius);
|
||||
|
||||
// edit icon
|
||||
if (m_info.material_state != AMSCanType::AMS_CAN_TYPE_EMPTY && m_info.material_state != AMSCanType::AMS_CAN_TYPE_NONE)
|
||||
|
@ -696,6 +742,12 @@ AMSRoad::AMSRoad(wxWindow *parent, wxWindowID id, Caninfo info, int canindex, in
|
|||
m_rode_mode = AMSRoadMode::AMS_ROAD_MODE_LEFT;
|
||||
}
|
||||
|
||||
ams_humidity_0 = ScalableBitmap(this, "ams_humidity_0", 18);
|
||||
ams_humidity_1 = ScalableBitmap(this, "ams_humidity_1", 18);
|
||||
ams_humidity_2 = ScalableBitmap(this, "ams_humidity_2", 18);
|
||||
ams_humidity_3 = ScalableBitmap(this, "ams_humidity_3", 18);
|
||||
ams_humidity_4 = ScalableBitmap(this, "ams_humidity_4", 18);
|
||||
|
||||
create(parent, id, pos, size);
|
||||
Bind(wxEVT_PAINT, &AMSRoad::paintEvent, this);
|
||||
wxWindow::SetBackgroundColour(AMS_CONTROL_DEF_BLOCK_BK_COLOUR);
|
||||
|
@ -703,8 +755,9 @@ AMSRoad::AMSRoad(wxWindow *parent, wxWindowID id, Caninfo info, int canindex, in
|
|||
|
||||
void AMSRoad::create(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size) { wxWindow::Create(parent, id, pos, size); }
|
||||
|
||||
void AMSRoad::Update(Caninfo info, int canindex, int maxcan)
|
||||
void AMSRoad::Update(AMSinfo amsinfo, Caninfo info, int canindex, int maxcan)
|
||||
{
|
||||
m_amsinfo = amsinfo;
|
||||
m_info = info;
|
||||
m_canindex = canindex;
|
||||
if (m_canindex == 0 && maxcan == 1) {
|
||||
|
@ -822,6 +875,27 @@ void AMSRoad::doRender(wxDC &dc)
|
|||
dc.SetBrush(wxBrush(m_road_def_color));
|
||||
dc.DrawRoundedRectangle(size.x * 0.37 / 2, size.y * 0.6 - size.y / 6, size.x * 0.63, size.y / 3, m_radius);
|
||||
}
|
||||
|
||||
if (m_canindex == 3) {
|
||||
if (m_amsinfo.ams_humidity == 5) {
|
||||
dc.DrawBitmap(ams_humidity_0.bmp(), wxPoint(size.x - ams_humidity_0.GetBmpSize().x - FromDIP(4), size.y - ams_humidity_0.GetBmpSize().y - FromDIP(8)));
|
||||
}
|
||||
else if (m_amsinfo.ams_humidity == 4) {
|
||||
dc.DrawBitmap(ams_humidity_1.bmp(), wxPoint(size.x - ams_humidity_0.GetBmpSize().x - FromDIP(4), size.y - ams_humidity_0.GetBmpSize().y - FromDIP(8)));
|
||||
}
|
||||
else if (m_amsinfo.ams_humidity == 3) {
|
||||
dc.DrawBitmap(ams_humidity_2.bmp(), wxPoint(size.x - ams_humidity_0.GetBmpSize().x - FromDIP(4), size.y - ams_humidity_0.GetBmpSize().y - FromDIP(8)));
|
||||
}
|
||||
else if (m_amsinfo.ams_humidity == 2) {
|
||||
dc.DrawBitmap(ams_humidity_3.bmp(), wxPoint(size.x - ams_humidity_0.GetBmpSize().x - FromDIP(4), size.y - ams_humidity_0.GetBmpSize().y - FromDIP(8)));
|
||||
}
|
||||
else if (m_amsinfo.ams_humidity == 1) {
|
||||
dc.DrawBitmap(ams_humidity_4.bmp(), wxPoint(size.x - ams_humidity_0.GetBmpSize().x - FromDIP(4), size.y - ams_humidity_0.GetBmpSize().y - FromDIP(8)));
|
||||
}
|
||||
else {
|
||||
dc.DrawBitmap(ams_humidity_0.bmp(), wxPoint(size.x - ams_humidity_0.GetBmpSize().x - FromDIP(4), size.y - ams_humidity_0.GetBmpSize().y - FromDIP(8)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AMSRoad::UpdatePassRoad(int tag_index, AMSPassRoadType type, AMSPassRoadSTEP step) {}
|
||||
|
@ -886,13 +960,19 @@ AMSItem::AMSItem() {}
|
|||
|
||||
AMSItem::AMSItem(wxWindow *parent, wxWindowID id, AMSinfo amsinfo, const wxSize cube_size, const wxPoint &pos, const wxSize &size) : AMSItem()
|
||||
{
|
||||
|
||||
ams_humidity_0 = ScalableBitmap(this, "ams_humidity_0", 18);
|
||||
ams_humidity_1 = ScalableBitmap(this, "ams_humidity_1", 18);
|
||||
ams_humidity_2 = ScalableBitmap(this, "ams_humidity_2", 18);
|
||||
ams_humidity_3 = ScalableBitmap(this, "ams_humidity_3", 18);
|
||||
ams_humidity_4 = ScalableBitmap(this, "ams_humidity_4", 18);
|
||||
|
||||
m_amsinfo = amsinfo;
|
||||
m_cube_size = cube_size;
|
||||
create(parent, id, pos, size);
|
||||
Bind(wxEVT_PAINT, &AMSItem::paintEvent, this);
|
||||
Bind(wxEVT_ENTER_WINDOW, &AMSItem::OnEnterWindow, this);
|
||||
Bind(wxEVT_LEAVE_WINDOW, &AMSItem::OnLeaveWindow, this);
|
||||
// Bind(wxEVT_LEFT_DOWN, &AMSItem::OnSelected, this);
|
||||
}
|
||||
|
||||
void AMSItem::Open()
|
||||
|
@ -1025,12 +1105,30 @@ void AMSItem::doRender(wxDC &dc)
|
|||
dc.SetBrush(wxBrush(*wxTRANSPARENT_BRUSH));
|
||||
dc.DrawLine(left, (size.y - AMS_ITEM_CUBE_SIZE.y) / 2, left, ((size.y - AMS_ITEM_CUBE_SIZE.y) / 2) + AMS_ITEM_CUBE_SIZE.y);
|
||||
|
||||
left += m_space;
|
||||
dc.SetFont(::Label::Body_13);
|
||||
dc.SetTextForeground(AMS_CONTROL_GRAY800);
|
||||
auto tsize = dc.GetTextExtent("00% RH");
|
||||
auto text = wxString::Format("%d%% RH", m_humidity);
|
||||
dc.DrawText(text, wxPoint(left, (size.y - tsize.y) / 2));
|
||||
left += m_space + m_space / 2;
|
||||
/* dc.SetFont(::Label::Body_13);
|
||||
dc.SetTextForeground(AMS_CONTROL_GRAY800);
|
||||
auto tsize = dc.GetTextExtent("00% RH");
|
||||
auto text = wxString::Format("%d%% RH", m_humidity);*/
|
||||
|
||||
if (m_amsinfo.ams_humidity == 5) {
|
||||
dc.DrawBitmap(ams_humidity_0.bmp(), wxPoint(left, (size.y - ams_humidity_0.GetBmpSize().y) / 2));
|
||||
}
|
||||
else if (m_amsinfo.ams_humidity == 4) {
|
||||
dc.DrawBitmap(ams_humidity_1.bmp(), wxPoint(left, (size.y - ams_humidity_1.GetBmpSize().y) / 2));
|
||||
}
|
||||
else if (m_amsinfo.ams_humidity == 3) {
|
||||
dc.DrawBitmap(ams_humidity_2.bmp(), wxPoint(left, (size.y - ams_humidity_2.GetBmpSize().y) / 2));
|
||||
}
|
||||
else if (m_amsinfo.ams_humidity == 2) {
|
||||
dc.DrawBitmap(ams_humidity_3.bmp(), wxPoint(left, (size.y - ams_humidity_3.GetBmpSize().y) / 2));
|
||||
}
|
||||
else if (m_amsinfo.ams_humidity == 1) {
|
||||
dc.DrawBitmap(ams_humidity_4.bmp(), wxPoint(left, (size.y - ams_humidity_4.GetBmpSize().y) / 2));
|
||||
}
|
||||
else {
|
||||
dc.DrawBitmap(ams_humidity_0.bmp(), wxPoint(left, (size.y - ams_humidity_0.GetBmpSize().y) / 2));
|
||||
}
|
||||
}
|
||||
|
||||
auto border_colour = AMS_CONTROL_BRAND_COLOUR;
|
||||
|
@ -1107,7 +1205,7 @@ void AmsCans::Update(AMSinfo info)
|
|||
for (auto i = 0; i < m_can_road_list.GetCount(); i++) {
|
||||
CanRoads *road = m_can_road_list[i];
|
||||
if (i < m_can_count) {
|
||||
road->canRoad->Update(info.cans[i], i, m_can_count);
|
||||
road->canRoad->Update(m_info, info.cans[i], i, m_can_count);
|
||||
road->canRoad->Show();
|
||||
} else {
|
||||
road->canRoad->Hide();
|
||||
|
@ -1902,7 +2000,7 @@ void AMSControl::SwitchAms(std::string ams_id)
|
|||
//item->amsItem->HideHumidity();
|
||||
}
|
||||
m_sizer_top->Layout();
|
||||
// m_panel_top->Fit();
|
||||
m_panel_top->Fit();
|
||||
}
|
||||
|
||||
for (auto i = 0; i < m_ams_cans_list.GetCount(); i++) {
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#define AMS_CONTROL_WHITE_COLOUR wxColour(255, 255, 255)
|
||||
#define AMS_CONTROL_BLACK_COLOUR wxColour(0, 0, 0)
|
||||
#define AMS_CONTROL_DEF_BLOCK_BK_COLOUR wxColour(238, 238, 238)
|
||||
#define AMS_CONTROL_DEF_LIB_BK_COLOUR wxColour(248, 248, 248)
|
||||
#define AMS_EXTRUDER_DEF_COLOUR wxColour(234, 234, 234)
|
||||
#define AMS_CONTROL_MAX_COUNT 4
|
||||
#define AMS_CONTRO_CALIBRATION_BUTTON_SIZE wxSize(FromDIP(150), FromDIP(28))
|
||||
|
@ -94,7 +95,7 @@ enum FilamentStep {
|
|||
|
||||
#define AMS_ITEM_CUBE_SIZE wxSize(FromDIP(14), FromDIP(14))
|
||||
#define AMS_ITEM_SIZE wxSize(FromDIP(82), FromDIP(27))
|
||||
#define AMS_ITEM_HUMIDITY_SIZE wxSize(FromDIP(150), FromDIP(27))
|
||||
#define AMS_ITEM_HUMIDITY_SIZE wxSize(FromDIP(120), FromDIP(27))
|
||||
#define AMS_CAN_LIB_SIZE wxSize(FromDIP(58), FromDIP(80))
|
||||
#define AMS_CAN_ROAD_SIZE wxSize(FromDIP(66), FromDIP(60))
|
||||
#define AMS_CAN_ITEM_HEIGHT_SIZE FromDIP(27)
|
||||
|
@ -111,18 +112,19 @@ struct Caninfo
|
|||
wxString material_name;
|
||||
wxColour material_colour = {*wxWHITE};
|
||||
AMSCanType material_state;
|
||||
int material_remain = 100;
|
||||
};
|
||||
|
||||
struct AMSinfo
|
||||
{
|
||||
public:
|
||||
std::string ams_id;
|
||||
std::vector<Caninfo> cans;
|
||||
|
||||
std::string current_can_id;
|
||||
AMSPassRoadSTEP current_step;
|
||||
AMSAction current_action;
|
||||
int curreent_filamentstep;
|
||||
std::string ams_id;
|
||||
std::vector<Caninfo> cans;
|
||||
std::string current_can_id;
|
||||
AMSPassRoadSTEP current_step;
|
||||
AMSAction current_action;
|
||||
int curreent_filamentstep;
|
||||
int ams_humidity = 0;
|
||||
|
||||
bool parse_ams_info(Ams *ams);
|
||||
};
|
||||
|
@ -268,6 +270,7 @@ public:
|
|||
void create(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize);
|
||||
|
||||
public:
|
||||
AMSinfo m_amsinfo;
|
||||
Caninfo m_info;
|
||||
int m_canindex = {0};
|
||||
AMSRoadMode m_rode_mode = {AMSRoadMode::AMS_ROAD_MODE_LEFT_RIGHT};
|
||||
|
@ -277,7 +280,15 @@ public:
|
|||
double m_radius = {4};
|
||||
wxColour m_road_def_color;
|
||||
wxColour m_road_color;
|
||||
void Update(Caninfo info, int canindex, int maxcan);
|
||||
void Update(AMSinfo amsinfo, Caninfo info, int canindex, int maxcan);
|
||||
|
||||
ScalableBitmap ams_humidity_0;
|
||||
ScalableBitmap ams_humidity_1;
|
||||
ScalableBitmap ams_humidity_2;
|
||||
ScalableBitmap ams_humidity_3;
|
||||
ScalableBitmap ams_humidity_4;
|
||||
bool m_show_humidity = { false };
|
||||
int m_humidity = { 0 };
|
||||
|
||||
void SetPassRoadColour(wxColour col);
|
||||
void SetMode(AMSRoadMode mode);
|
||||
|
@ -313,7 +324,13 @@ public:
|
|||
void HideHumidity();
|
||||
void SetHumidity(int humidity);
|
||||
virtual bool Enable(bool enable = true);
|
||||
|
||||
AMSinfo m_amsinfo;
|
||||
ScalableBitmap ams_humidity_0;
|
||||
ScalableBitmap ams_humidity_1;
|
||||
ScalableBitmap ams_humidity_2;
|
||||
ScalableBitmap ams_humidity_3;
|
||||
ScalableBitmap ams_humidity_4;
|
||||
|
||||
protected:
|
||||
wxSize m_cube_size;
|
||||
|
|
Loading…
Reference in a new issue