Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring header style code in TableView #2

Open
kinderp opened this issue Aug 11, 2019 · 0 comments
Open

Refactoring header style code in TableView #2

kinderp opened this issue Aug 11, 2019 · 0 comments
Labels
refactoring refactoring

Comments

@kinderp
Copy link
Owner

kinderp commented Aug 11, 2019

Same or similar code is present in table_view.TableView create a function to avoid repetitions.

  • render_header()
                   class_name = getattr(self.model, elem).__class__.__name__
                    if elem in self.style_header and class_name == 'TextField':
                        # atm header style con be applied only to TextField
                        # type. ( and class_name == 'TextField )

                        style_name = self.style_header[elem]['style']
                        commands = self.style_header[elem]['commands']
                        my_style = Styles.style(style=style_name,
                                                commands=commands)

                        new_row.append(getattr(self.model,
                                               elem).render(style=my_style))
                    else:
                        new_row.append(getattr(self.model, elem).render())
  • render_inner_table()
                    class_name = getattr(self.model, elem).__class__.__name__
                    if elem in self.style_header and class_name == 'TextField':
                        # atm header style con be applied only to TextField
                        # type. ( and class_name == 'TextField )
                        style_name = self.style_header[elem]['style']
                        commands = self.style_header[elem]['commands']
                        my_style = Styles.style(style=style_name,
                                                commands=commands)

                        compliant_data[sr][sc] = getattr(self.model, elem).render(style=my_style)
                    else:
                        compliant_data[sr][sc] = getattr(self.model, elem).render()
@kinderp kinderp added the refactoring refactoring label Aug 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring refactoring
Projects
None yet
Development

No branches or pull requests

1 participant