Bug fixes

This commit is contained in:
St.Huang 2018-08-27 20:59:15 +08:00
parent f79ac9b6c4
commit a0757644e8
2 changed files with 34 additions and 34 deletions

View File

@ -230,18 +230,18 @@ class OptionsDialog(Dialog):
except Exception: pass except Exception: pass
while len(self.tabs) > 0: while len(self.tabs) > 0:
self.removeTab(0, True) self.removeTab(0, True)
# # tabs
conf = config.get_maps(self.current_model['id']) conf = config.get_maps(self.current_model['id'])
maps_list = {'list': [conf], 'def': 0} if isinstance(conf, list) else conf maps_list = {'list': [conf], 'def': 0} if isinstance(conf, list) else conf
for maps in maps_list['list']: for maps in maps_list['list']:
self.addTab(maps, False) self.addTab(maps, False)
self.tab_widget.setCurrentIndex(maps_list['def'])
self.tab_widget.currentChanged.connect(self.changedTab) self.tab_widget.currentChanged.connect(self.changedTab)
self.changedTab(self.tab_widget.currentIndex()) # value
self.changedTab(maps_list['def'])
self.tab_widget.setCurrentIndex(maps_list['def'])
# size # size
tab_frame_width = self.tabs[self.tab_widget.currentIndex()].frameSize().width()
self.resize( self.resize(
tab_frame_width + self.frameSize().width() - tab_frame_width, WIDGET_SIZE.dialog_width,
min(max(3, len(self.current_model['flds'])+1), 14) * WIDGET_SIZE.map_max_height + WIDGET_SIZE.dialog_height_margin min(max(3, len(self.current_model['flds'])+1), 14) * WIDGET_SIZE.map_max_height + WIDGET_SIZE.dialog_height_margin
) )
self.save() self.save()
@ -272,7 +272,7 @@ class OptionsDialog(Dialog):
self.tab_widget.setTabIcon(k, self._NULL_ICON) self.tab_widget.setTabIcon(k, self._NULL_ICON)
# add flag # add flag
self.tab_widget.setTabIcon(i, self._OK_ICON) self.tab_widget.setTabIcon(i, self._OK_ICON)
self.tabs[i].build() self.tabs[i].build_layout()
def show_models(self): def show_models(self):
''' '''
@ -318,16 +318,16 @@ class TabContent(QScrollArea):
self._last_checkeds = None self._last_checkeds = None
self._options = list() self._options = list()
self._was_built = False self._was_built = False
# add dicts mapping # dicts mapping
self.dicts_widget = QWidget() dicts = QWidget(self)
self.dicts_layout = QGridLayout() dicts.setLayout(QGridLayout())
self.dicts_layout.setSizeConstraint(QLayout.SetMinAndMaxSize)
self.dicts_widget.setLayout(self.dicts_layout)
self.setFrameShape(QFrame.NoFrame) self.setFrameShape(QFrame.NoFrame)
self.setWidgetResizable(True) self.setWidgetResizable(True)
self.setWidget(self.dicts_widget) self.setWidget(dicts)
self.dicts_layout = dicts.layout()
#self.dicts_layout.setSizeConstraint(QLayout.SetFixedSize)
def build(self): def build_layout(self):
''' '''
build dictionaryfields etc build dictionaryfields etc
''' '''

View File

@ -230,18 +230,18 @@ class OptionsDialog(Dialog):
except Exception: pass except Exception: pass
while len(self.tabs) > 0: while len(self.tabs) > 0:
self.removeTab(0, True) self.removeTab(0, True)
# # tabs
conf = config.get_maps(self.current_model['id']) conf = config.get_maps(self.current_model['id'])
maps_list = {'list': [conf], 'def': 0} if isinstance(conf, list) else conf maps_list = {'list': [conf], 'def': 0} if isinstance(conf, list) else conf
for maps in maps_list['list']: for maps in maps_list['list']:
self.addTab(maps, False) self.addTab(maps, False)
self.tab_widget.setCurrentIndex(maps_list['def'])
self.tab_widget.currentChanged.connect(self.changedTab) self.tab_widget.currentChanged.connect(self.changedTab)
self.changedTab(self.tab_widget.currentIndex()) # value
self.changedTab(maps_list['def'])
self.tab_widget.setCurrentIndex(maps_list['def'])
# size # size
tab_frame_width = self.tabs[self.tab_widget.currentIndex()].frameSize().width()
self.resize( self.resize(
tab_frame_width + self.frameSize().width() - tab_frame_width, WIDGET_SIZE.dialog_width,
min(max(3, len(self.current_model['flds'])+1), 14) * WIDGET_SIZE.map_max_height + WIDGET_SIZE.dialog_height_margin min(max(3, len(self.current_model['flds'])+1), 14) * WIDGET_SIZE.map_max_height + WIDGET_SIZE.dialog_height_margin
) )
self.save() self.save()
@ -272,7 +272,7 @@ class OptionsDialog(Dialog):
self.tab_widget.setTabIcon(k, self._NULL_ICON) self.tab_widget.setTabIcon(k, self._NULL_ICON)
# add flag # add flag
self.tab_widget.setTabIcon(i, self._OK_ICON) self.tab_widget.setTabIcon(i, self._OK_ICON)
self.tabs[i].build() self.tabs[i].build_layout()
def show_models(self): def show_models(self):
''' '''
@ -318,16 +318,16 @@ class TabContent(QScrollArea):
self._last_checkeds = None self._last_checkeds = None
self._options = list() self._options = list()
self._was_built = False self._was_built = False
# add dicts mapping # dicts mapping
self.dicts_widget = QWidget() dicts = QWidget(self)
self.dicts_layout = QGridLayout() dicts.setLayout(QGridLayout())
self.dicts_layout.setSizeConstraint(QLayout.SetMinAndMaxSize)
self.dicts_widget.setLayout(self.dicts_layout)
self.setFrameShape(QFrame.NoFrame) self.setFrameShape(QFrame.NoFrame)
self.setWidgetResizable(True) self.setWidgetResizable(True)
self.setWidget(self.dicts_widget) self.setWidget(dicts)
self.dicts_layout = dicts.layout()
#self.dicts_layout.setSizeConstraint(QLayout.SetFixedSize)
def build(self): def build_layout(self):
''' '''
build dictionaryfields etc build dictionaryfields etc
''' '''