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

IEP-1376: Linux ESP-IDF Manager buttons issue #1092

Merged
merged 1 commit into from
Dec 11, 2024
Merged

Conversation

alirana01
Copy link
Collaborator

@alirana01 alirana01 commented Dec 5, 2024

Description

ESP-IDF Manager buttons issue on Linux is due to the GTK issues on Linux, the only workaround is to show the buttons with bounds of cells that works or rather looks better on windows but on Linux the buttons still appear a bit truncated and there is no fix for that yet. This is better in a sense that the user can at least see the buttons.
See the image for linux
image

for windows
image

Fixes # (IEP-1376)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How has this been tested?

Use the jira ticket for more information.

Test Configuration:

  • ESP-IDF Version: any
  • OS (Windows,Linux and macOS): all

Checklist

  • PR Self Reviewed
  • Applied Code formatting
  • Verified on all platforms - Windows,Linux and macOS

Summary by CodeRabbit

  • New Features

    • Enhanced UI functionality and layout for improved user experience.
    • Dynamic button sizing based on table cell dimensions for consistent appearance.
  • Bug Fixes

    • Adjusted table item height for better visual presentation.
  • Refactor

    • Improved layout properties for button alignment and sizing within the table.

@alirana01 alirana01 self-assigned this Dec 5, 2024
Copy link

coderabbitai bot commented Dec 5, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

The changes in this pull request focus on the ESPIDFMainTablePage class, enhancing the user interface by modifying button dimensions and layout properties. A new Rectangle import is introduced for managing button sizes, and table item heights are adjusted to 30 pixels. The column weight for the removeColumn is increased, and button layout properties are refined for better alignment. The dispose method remains unchanged for resource management. Overall, these modifications aim to improve the visual consistency and responsiveness of the UI components within the table.

Changes

File Path Change Summary
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/manager/pages/ESPIDFMainTablePage.java - Added Rectangle import for button dimension management.
- Updated createIdfTable to set table item height to 30 pixels.
- Changed removeColumn weight from 2 to 3.
- Enhanced createButtonsForLastCol to use Rectangle for dynamic button sizing and set minimum height to 30 pixels.
- Refined button composite layout properties for better alignment.

Possibly related PRs

Suggested reviewers

  • kolipakakondal
  • sigmaaa

🐇 In the UI where buttons play,
A rectangle helps them stay,
With heights that match, they stand so tall,
In tables where they won't fall.
A layout fine, a sight to see,
Hooray for changes, hop with glee! 🥕


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 867d9c1 and 08eeedc.

📒 Files selected for processing (1)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/manager/pages/ESPIDFMainTablePage.java (8 hunks)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Experiment)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (2)
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/manager/pages/ESPIDFMainTablePage.java (2)

Line range hint 144-156: Remove redundant MeasureItem listener

There are two MeasureItem listeners with different height values (25px and 30px). The second one overwrites the first, making the first listener redundant.

 Table table = tableViewer.getTable();
 table.setHeaderVisible(true);
 table.setLinesVisible(true);
-table.addListener(SWT.MeasureItem, event -> {
-    event.height = 25;
-});
 comparator = new ColumnViewerComparator();
 tableViewer.setComparator(comparator);
 setupColumns();
 table.addListener(SWT.MeasureItem, e -> {
     e.height = 30;
 });

473-486: Optimize multiple layout and redraw calls

Multiple layout and redraw calls might impact performance. Consider consolidating them.

 removeButton.setSize(cellBounds.width, buttonHeight);
-removeButton.redraw();
 
 editor.grabHorizontal = true;
 editor.grabVertical = true;
 editor.horizontalAlignment = SWT.CENTER;
 editor.verticalAlignment = SWT.CENTER;
 editor.minimumHeight = removeButton.getSize().y;
 editor.minimumWidth = removeButton.getSize().x;
 editor.setEditor(buttonComposite, item, cell.getColumnIndex());
-buttonComposite.layout(true, true);
-buttonComposite.redraw();
-editor.layout();
-tableViewer.getTable().layout(true, true);
+// Single layout call at the table level should be sufficient
+tableViewer.getTable().layout(true, true);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between f9c06bb and 867d9c1.

📒 Files selected for processing (1)
  • bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/manager/pages/ESPIDFMainTablePage.java (8 hunks)
🔇 Additional comments (4)
bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/tools/manager/pages/ESPIDFMainTablePage.java (4)

25-25: LGTM: Rectangle import is required for button dimension management

The addition of Rectangle import is appropriate for managing button dimensions within table cells.


274-274: LGTM: Increased column weight improves button visibility

The increased column weight (3) provides more space for the buttons, which helps with the Linux GTK visibility issues.


439-440: LGTM: Button height calculation prevents truncation

The button height calculation ensures buttons fit within cell bounds while maintaining a minimum height of 30 pixels.


Line range hint 424-482: Verify button appearance across platforms

While the changes improve button visibility on Linux, we should verify that they don't negatively impact other platforms.

✅ Verification successful

Let me analyze the search results. The code changes in question involve SWT button styling and layout in a table cell editor. From the search results, I can see that:

  1. There are no platform-specific UI adjustments for this particular component in the codebase.
  2. The button styling changes (SWT.PUSH | SWT.FLAT) and layout code are using standard SWT APIs that are well-supported across all platforms.
  3. The changes made (setting bounds, using FillLayout, setting minimum sizes) are platform-agnostic SWT operations.

Let me generate the final response:

Button styling changes are platform-agnostic and safe

The UI changes use standard SWT APIs and layout mechanisms that are consistently supported across all platforms. The modifications to button appearance and cell layout don't involve any platform-specific code paths or styling that could cause issues on different operating systems.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for platform-specific UI adjustments or known issues
rg -i "gtk|linux|windows|macos" --type java

Length of output: 17428

Copy link
Collaborator

@sigmaaa sigmaaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! @AndriiFilippov PTAL

@AndriiFilippov
Copy link
Collaborator

@alirana01 hi !

Tested:
OS - Linux Ubuntu

able to see and use "Delete" / "Refresh" buttons ✅

LGTM 👍

@AndriiFilippov AndriiFilippov merged commit ccf28a5 into master Dec 11, 2024
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants