From 2fbb65167e33383b0f5a6a10f4ac9d2f05d8828b Mon Sep 17 00:00:00 2001 From: jzzhuang <840064358@qq.com> Date: Thu, 2 Nov 2023 11:56:23 +0800 Subject: [PATCH] Squashed commit of the following: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit commit 701942102ec5c18469755746ebc6dfbc4a8aaee6 Author: Yihuo <65127095+Liangtie@users.noreply.github.com> Date: Tue Oct 31 14:24:12 2023 +0800 Fix/kicad6.0 unavailable api (#11) * fix: Remove apis not available in kicad 6.0 Remove the duplicated flags in the plugin so as to be used in Kicad 6.0 * fix: Correct the name section in metadata.json * fix: Prefer and to & for the plugin name * fix: add kicad_version_max 7.0.8 in the metajson commit 7038e4d4f2d38173dacddf241dcc9f790fa8f897 Author: jzzhuang <840064358@qq.com> Date: Fri Oct 27 18:40:22 2023 +0800 Update metadata.template.json commit 9833106706c2d46cbabe5a0dcaa4234b54a6b220 Author: Yihuo <65127095+Liangtie@users.noreply.github.com> Date: Fri Oct 27 17:39:01 2023 +0800 feat: Update readme and metadata.json (#8) * feat: Update readme and metadata.json * Add README zh * Update homepage commit 130303d62d1a7d2222e0d7ff5beebf6c1fb4b788 Author: Yihuo <65127095+Liangtie@users.noreply.github.com> Date: Thu Oct 26 18:19:27 2023 +0800 fix: :bug: Fix nonetype error throwing from pcbnew.ToMils (#7) * fix: :bug: Fix nonetype error throwing from pcbnew.ToMils Check if the param from design setting is None before converting it * feat: Update the gif path in the README commit ff303ada8856dd89f69b0aa92c2066bc53ab0eb0 Author: Yihuo <65127095+Liangtie@users.noreply.github.com> Date: Thu Oct 26 12:03:07 2023 +0800 feat: Prefer reading lang setting through pcbnew.GetLanguage (#5) Try reading lang setting from Kicad context before reading lang setting from json file commit bd15e70339df41e3f96181951cda1aedebebcfa2 Author: Yihuo <65127095+Liangtie@users.noreply.github.com> Date: Thu Oct 26 11:59:04 2023 +0800 加入Credi声明、并在代码中注明版权或者引用 (#3) * Refact the dir * Update dev instruction p * Init modules * Add order and price * Add pcb_fabrication * Add service iIp * Remove service * Add adt for the request info * Add i18n template * add main dialog * Remove dists * add base_info_view * add ui_base_info * Finish the base info view * add UiProcessInfo * Add ui_personalized * Finish Personalized info * Finish the process info widget * Finish the dialog * Init i18n * Fix the sys path * Fix the syle * Fix base info * Fix the initial size * Fix the size * Fix the initial size for base info * Fix duplicated path * Add order info * Finish main window * Finish the order info panel * Fix the size for order info * Fix the scrollbar * Finish the flat button * add language * Add lang setting menu * Add models for order info * Remove dist * Remove dist * Add po files * Enable i18n * Remove dist files * Remove dist * Add setting manager * add re_translatable * add LocaleChangeEvent * Fix painting * Remove dist * read the language setting from kicad client * Remove dist * Update locales * Fix the base class for MainFrame * Fix the locale path * Update translation * Add ja * Finish the translation * Update translation * Fix translation * Update translation * Update UI * Fix the unit * Restore the old widgets * Update utils ' * Add kicad * Add board manager * add pcb_fabrication_evt_list * Finish the connection for base info * Fix base info * Add board manager * Adjust the base size for special process * Enable SILK_SCREEN_COLOR_BY_SOLDER_COLOR * Finish the constraint between the UI component * Fix the base info * Add base request * Fix the sp request * add snippy for params * Add number round * Finish the models mapping * Finish the api for querying price * Add order module * Add summary module * Add summary_panel * Add place order impl * Finish placing order * enable order region setting * Fix the OrderRegion * Add smt pcb models * Finish the price summary * Finish the pcb * Update translation * Prepare to import region change * Add cn params in the form * Fix translation Fix the region * Fix the width * Fix the available board thickness * Fix the board thickness * Record the window size * Finish adjusting the window layout * Adjust the order_summary_model * Finish showing the emergency price * Update Japanese translation * Finish the translatin * Add ComboBoxIgnoreWheel * Finish ComboBoxIgnoreWheel * add ComboBoxIgnoreWheel to builtin * FInish ComboBoxIgnoreWheel * Fix the summary model * Update the api * Remove dist files * Add release plugin * Always clear content while querying price * Migrate the original PCM * Update the create_pcm_archive.sh * Update git ignore * Adjust the ci for testing * Fxi the token * Fix the pcm script * Restore the original workflow yml * Fix the archive script * Revert "Restore the original workflow yml" This reverts commit f680d78ac63c24eae9b3267ec14e104338873ec0. * Fix the pcm script * Fix the pcm script * Fix the PCM script * Update the pcm script * Fix the pcm path * Fix the geni18n script * install wxPython in the script * Fix the translation * Update the mo files * Comment the translation step * Ignore the mo file * Fix the dumplicated lang_const * Adjust the geni18n script to run on github ci * Adjust the script to setup env * Install the python-gettext in the ci * Ajust the gen18n script to run on ci * Enable reading region from IP * Restore the yml * fmt the yml * Fix the lang setting menu * Adjust the yml for test * Revert "Adjust the yml for test" This reverts commit f839cd20430609ac365eb290785ab00872923472. * Fix the null parent in the price summary model * Fix the parent for price item * Fix the check state of the lang setting btn * Finish the api for placing order through hqpcb * Add value mapping * Add form value mapper * Enable jp order region * Finish the plugin * Fix the board manager * Fix the generate_geber method while layer_count>6 * Fix generate_geber * Check if the layer count is supported * Fix the stack up * Adjust the runner to WIndows * Use ubuntu-20.04 as runner * Restore the .yml * Formmatter test * Fix the panel calc * Fix the blind value * Remove dist * Fix the cover * Enable modal dialog * Add single plugin * Add setup_trace_and_via in the base info * Add test * add query price test case * Restore the original yml config * Fix the min trace * Add simple * Remove dist yml * Prefer GetLanguage to get the language setting * Fix the ip * Format README for updating * Add credits declaration * Update git demo commit e8d3326a652d49cfe3b5aa3710a110a46bfd4781 Author: Yihuo <65127095+Liangtie@users.noreply.github.com> Date: Wed Oct 25 15:09:54 2023 +0800 国际化、日本及中国大陆地区询价下单 (#2) * Refact the dir * Update dev instruction p * Init modules * Add order and price * Add pcb_fabrication * Add service iIp * Remove service * Add adt for the request info * Add i18n template * add main dialog * Remove dists * add base_info_view * add ui_base_info * Finish the base info view * add UiProcessInfo * Add ui_personalized * Finish Personalized info * Finish the process info widget * Finish the dialog * Init i18n * Fix the sys path * Fix the syle * Fix base info * Fix the initial size * Fix the size * Fix the initial size for base info * Fix duplicated path * Add order info * Finish main window * Finish the order info panel * Fix the size for order info * Fix the scrollbar * Finish the flat button * add language * Add lang setting menu * Add models for order info * Remove dist * Remove dist * Add po files * Enable i18n * Remove dist files * Remove dist * Add setting manager * add re_translatable * add LocaleChangeEvent * Fix painting * Remove dist * read the language setting from kicad client * Remove dist * Update locales * Fix the base class for MainFrame * Fix the locale path * Update translation * Add ja * Finish the translation * Update translation * Fix translation * Update translation * Update UI * Fix the unit * Restore the old widgets * Update utils ' * Add kicad * Add board manager * add pcb_fabrication_evt_list * Finish the connection for base info * Fix base info * Add board manager * Adjust the base size for special process * Enable SILK_SCREEN_COLOR_BY_SOLDER_COLOR * Finish the constraint between the UI component * Fix the base info * Add base request * Fix the sp request * add snippy for params * Add number round * Finish the models mapping * Finish the api for querying price * Add order module * Add summary module * Add summary_panel * Add place order impl * Finish placing order * enable order region setting * Fix the OrderRegion * Add smt pcb models * Finish the price summary * Finish the pcb * Update translation * Prepare to import region change * Add cn params in the form * Fix translation Fix the region * Fix the width * Fix the available board thickness * Fix the board thickness * Record the window size * Finish adjusting the window layout * Adjust the order_summary_model * Finish showing the emergency price * Update Japanese translation * Finish the translatin * Add ComboBoxIgnoreWheel * Finish ComboBoxIgnoreWheel * add ComboBoxIgnoreWheel to builtin * FInish ComboBoxIgnoreWheel * Fix the summary model * Update the api * Remove dist files * Add release plugin * Always clear content while querying price * Migrate the original PCM * Update the create_pcm_archive.sh * Update git ignore * Adjust the ci for testing * Fxi the token * Fix the pcm script * Restore the original workflow yml * Fix the archive script * Revert "Restore the original workflow yml" This reverts commit f680d78ac63c24eae9b3267ec14e104338873ec0. * Fix the pcm script * Fix the pcm script * Fix the PCM script * Update the pcm script * Fix the pcm path * Fix the geni18n script * install wxPython in the script * Fix the translation * Update the mo files * Comment the translation step * Ignore the mo file * Fix the dumplicated lang_const * Adjust the geni18n script to run on github ci * Adjust the script to setup env * Install the python-gettext in the ci * Ajust the gen18n script to run on ci * Enable reading region from IP * Restore the yml * fmt the yml * Fix the lang setting menu * Adjust the yml for test * Revert "Adjust the yml for test" This reverts commit f839cd20430609ac365eb290785ab00872923472. * Fix the null parent in the price summary model * Fix the parent for price item * Fix the check state of the lang setting btn * Finish the api for placing order through hqpcb * Add value mapping * Add form value mapper * Enable jp order region * Finish the plugin * Fix the board manager * Fix the generate_geber method while layer_count>6 * Fix generate_geber * Check if the layer count is supported * Fix the stack up * Adjust the runner to WIndows * Use ubuntu-20.04 as runner * Restore the .yml * Formmatter test * Fix the panel calc * Fix the blind value * Remove dist * Fix the cover * Enable modal dialog * Add single plugin * Add setup_trace_and_via in the base info * Add test * add query price test case * Restore the original yml config * Fix the min trace * Add simple * Remove dist yml --- PCM/metadata.template.json | 3 +- kicad_amf_plugin/gui/main_frame.py | 1 - .../gui/summary/ui_summary_panel.fbp | 18 +++++----- .../gui/summary/ui_summary_panel.py | 18 +++++----- kicad_amf_plugin/language/lang_const.py | 33 +++++++++++++------ .../process/process_info_view.py | 1 - 6 files changed, 42 insertions(+), 32 deletions(-) diff --git a/PCM/metadata.template.json b/PCM/metadata.template.json index 67f7a24..5676b14 100644 --- a/PCM/metadata.template.json +++ b/PCM/metadata.template.json @@ -1,6 +1,6 @@ { "$schema": "https://go.kicad.org/pcm/schemas/v1", - "name": "HQPCB / HQ NextPCB Quote & Order", + "name": "HQPCB / HQ NextPCB Quote and Order", "description": "Start prototype and assembly by sending files to NextPCB with just one click\nAutomatic extract key parameters from pcbnew and get real-time quotation within KiCad", "description_full": "Click this plugin for high quality prototyping and assembly services, NextPCB will commit to meeting your needs to the greatest extent.\n\nWhen you click NextPCB Plug-in button, we will export these files in your project:\n\n1. Gerber files in correct format for production\n2. IPC-Netlist file\n3. Bom-file that includes all information of components (please note designator, quantity, MPN/part number, package/footprint are necessary)\n4. Pick and Place-file used in assembly\n\nYou can click \"Save to Cart\" to place an order immediately after uploading the files ( usually only takes a few seconds), our engineers will double check the files before the production.\n\nAbout NextPCB:\n\nNextPCB is a Chinese company specializing in PCB prototyping and assembly, devotes to offer one-stop service. The build-time for standard PCBs is 24hrs. Our upgraded material with TG150-160 costs as low as $5/10pcs while our remarkable after-sale services are standing by for any questions you may encounter. As a sponsor of KiCad, we will always support its development.", "identifier": "com.github.SYSUeric66.kicad-amf-plugin", @@ -26,6 +26,7 @@ "version": "VERSION_HERE", "status": "testing", "kicad_version": "6.0", + "kicad_version_max": "7.0.8", "download_sha256": "SHA256_HERE", "download_size": DOWNLOAD_SIZE_HERE, "download_url": "DOWNLOAD_URL_HERE", diff --git a/kicad_amf_plugin/gui/main_frame.py b/kicad_amf_plugin/gui/main_frame.py index 82e5b25..4841cf6 100644 --- a/kicad_amf_plugin/gui/main_frame.py +++ b/kicad_amf_plugin/gui/main_frame.py @@ -84,7 +84,6 @@ def __init__(self, board_manager: BoardManager, size, parent=None): self.init_ui() def init_ui(self): - wx.SizerFlags.DisableConsistencyChecks() self.SetSizeHints(wx.DefaultSize, wx.DefaultSize) main_sizer = wx.BoxSizer(wx.HORIZONTAL) diff --git a/kicad_amf_plugin/gui/summary/ui_summary_panel.fbp b/kicad_amf_plugin/gui/summary/ui_summary_panel.fbp index 44c2e5c..d8f4b8b 100644 --- a/kicad_amf_plugin/gui/summary/ui_summary_panel.fbp +++ b/kicad_amf_plugin/gui/summary/ui_summary_panel.fbp @@ -57,20 +57,20 @@ bSizer1 wxVERTICAL none - + 5 - wxALIGN_CENTER|wxEXPAND + wxEXPAND 0 - + bSizer3 wxHORIZONTAL none - + 5 - wxALIGN_CENTER|wxEXPAND + wxEXPAND 1 - + wxID_ANY Preference @@ -304,7 +304,7 @@ 5 - wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND + wxEXPAND 0 @@ -313,7 +313,7 @@ none 5 - wxALIGN_CENTER|wxALL|wxEXPAND + wxALL|wxEXPAND 1 1 @@ -375,7 +375,7 @@ 5 - wxALIGN_CENTER|wxALL|wxEXPAND + wxALL|wxEXPAND 1 1 diff --git a/kicad_amf_plugin/gui/summary/ui_summary_panel.py b/kicad_amf_plugin/gui/summary/ui_summary_panel.py index 4a0b0a8..f9a8202 100644 --- a/kicad_amf_plugin/gui/summary/ui_summary_panel.py +++ b/kicad_amf_plugin/gui/summary/ui_summary_panel.py @@ -17,6 +17,9 @@ PB_STYLE_SQUARE, ) +import gettext + +_ = gettext.gettext ########################################################################### ## Class UiSummaryPanel @@ -68,9 +71,9 @@ def __init__( ) sbSizer4.Add(self.btn_set_language, 0, wx.ALL, 5) - bSizer3.Add(sbSizer4, 1, wx.ALIGN_CENTER | wx.EXPAND, 5) + bSizer3.Add(sbSizer4, 1, wx.EXPAND, 5) - bSizer1.Add(bSizer3, 0, wx.ALIGN_CENTER | wx.EXPAND, 5) + bSizer1.Add(bSizer3, 0, wx.EXPAND, 5) sbSizer1 = wx.StaticBoxSizer( wx.StaticBox(self, wx.ID_ANY, _("Cost detail")), wx.VERTICAL @@ -110,7 +113,7 @@ def __init__( style=PB_STYLE_GRADIENT, label=_("Update Price"), ) - bSizer31.Add(self.btn_update_price, 1, wx.ALIGN_CENTER | wx.ALL | wx.EXPAND, 5) + bSizer31.Add(self.btn_update_price, 1, wx.ALL | wx.EXPAND, 5) self.btn_place_order = PlateButton( self, @@ -118,14 +121,9 @@ def __init__( style=PB_STYLE_GRADIENT, label=_("Add to Cart"), ) - bSizer31.Add(self.btn_place_order, 1, wx.ALIGN_CENTER | wx.ALL | wx.EXPAND, 5) + bSizer31.Add(self.btn_place_order, 1, wx.ALL | wx.EXPAND, 5) - bSizer1.Add( - bSizer31, - 0, - wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, - 5, - ) + bSizer1.Add(bSizer31, 0, wx.EXPAND, 5) self.SetSizer(bSizer1) self.Layout() diff --git a/kicad_amf_plugin/language/lang_const.py b/kicad_amf_plugin/language/lang_const.py index ae111f1..aaf22ed 100644 --- a/kicad_amf_plugin/language/lang_const.py +++ b/kicad_amf_plugin/language/lang_const.py @@ -13,21 +13,34 @@ def get_supported_language(): import wx - return ( - wx.LANGUAGE_ENGLISH, - wx.LANGUAGE_JAPANESE_JAPAN, - wx.LANGUAGE_CHINESE_SIMPLIFIED, - ) + try: + # NOTE - LANGUAGE_JAPANESE_JAPAN is not available until Kicad 6.0 + return ( + wx.LANGUAGE_ENGLISH, + wx.LANGUAGE_JAPANESE_JAPAN, + wx.LANGUAGE_CHINESE_SIMPLIFIED, + ) + except: + return ( + wx.LANGUAGE_ENGLISH, + wx.LANGUAGE_CHINESE_SIMPLIFIED, + ) def code_to_wx(): import wx - return { - "en": wx.LANGUAGE_ENGLISH, - "ja": wx.LANGUAGE_JAPANESE_JAPAN, - "zh_CN": wx.LANGUAGE_CHINESE_SIMPLIFIED, - } + try: + return { + "en": wx.LANGUAGE_ENGLISH, + "ja": wx.LANGUAGE_JAPANESE_JAPAN, + "zh_CN": wx.LANGUAGE_CHINESE_SIMPLIFIED, + } + except: + return { + "en": wx.LANGUAGE_ENGLISH, + "zh_CN": wx.LANGUAGE_CHINESE_SIMPLIFIED, + } def fool_translation(): diff --git a/kicad_amf_plugin/pcb_fabrication/process/process_info_view.py b/kicad_amf_plugin/pcb_fabrication/process/process_info_view.py index b1ca0fe..86ea690 100644 --- a/kicad_amf_plugin/pcb_fabrication/process/process_info_view.py +++ b/kicad_amf_plugin/pcb_fabrication/process/process_info_view.py @@ -273,7 +273,6 @@ def on_region_changed(self): pass def setup_trace_and_via(self): - designSettings = self.board_manager.board.GetDesignSettings() minTraceWidth = ( designSettings.m_TrackMinWidth