Skip to content

Commit

Permalink
WIP #2071 ux issue
Browse files Browse the repository at this point in the history
  • Loading branch information
msevestre committed Jan 31, 2022
1 parent 574c726 commit 7b88ea2
Show file tree
Hide file tree
Showing 46 changed files with 269 additions and 214 deletions.
2 changes: 1 addition & 1 deletion src/PKSim.BatchTool/Views/FolderListSnapshotView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public override void InitializeBinding()
.WithCaption(UIConstants.EMPTY_COLUMN)
.WithShowButton(ShowButtonModeEnum.ShowAlways)
.WithRepository(x => _deleteRepository)
.WithFixedWidth(UIConstants.Size.EMBEDDED_BUTTON_WIDTH);
.WithFixedWidth(OSPSuite.UI.UIConstants.Size.EMBEDDED_BUTTON_WIDTH);

_gridViewBinder.Changed += NotifyViewChanged;

Expand Down
31 changes: 1 addition & 30 deletions src/PKSim.Core/CoreConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1283,36 +1283,7 @@ public static string ParticlesApplicationWithNBins(int binIndex)
}
}

public static class UI
{
public static readonly int BUILDING_BLOCK_SELECTION_SIZE = 32;
public static readonly int PARAMETER_WIDTH = 110;
public static readonly int DATA_SOURCE_WIDTH = 180;
public const int SIMULATION_SETTINGS_WIDTH = 750;
public const int SIMULATION_SETTINGS_HEIGHT = 650;
public const int SIMULATION_VIEW_WIDTH = 700;
public const int INDIVIDUAL_VIEW_WIDTH = 880;
public const int INDIVIDUAL_VIEW_HEIGHT = 780;
public const int CONFIGURE_SIMULATION_VIEW_HEIGHT = 708;
public const int CREATE_SIMULATION_VIEW_HEIGHT = CONFIGURE_SIMULATION_VIEW_HEIGHT + 40;

public const int EXPRESSION_QUERY_VIEW_HEIGHT = 900;
public const int EXPRESSION_QUERY_VIEW_WIDTH = 1100;

public const int FORMULATION_VIEW_WIDTH = 650;
public const int FORMULATION_VIEW_HEIGHT = 760;

public const int OBSERVER_VIEW_HEIGHT = 760;
public const int OBSERVER_VIEW_WIDTH = 650;

public const int PROTOCOL_VIEW_WIDTH = 700;
public const int PROTOCOL_VIEW_HEIGHT = 760;

public const int EXPRESSION_PROFILE_VIEW_HEIGHT = 900;
public const int EXPRESSION_PROFILE_VIEW_WIDTH = 760;

}


public static class Covariates
{
public static readonly string GENDER = "Gender";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ private void addNamingPatterns(DataImporterSettings dataImporterSettings)
{
Caption = $"{CoreConstants.ProductDisplayName} - {PKSimConstants.UI.ImportObservedData}",
IconName = ApplicationIcons.ObservedData.IconName,
CheckMolWeightAgainstMolecule = true
// CheckMolWeightAgainstMolecule = true
};
addNamingPatterns(dataImporterSettings);
dataImporterSettings.NameOfMetaDataHoldingMoleculeInformation = Constants.ObservedData.MOLECULE;
Expand Down
2 changes: 1 addition & 1 deletion src/PKSim.UI/Extensions/LayoutControlItemExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static void FillWith(this LayoutControlItem layoutControlItem, UxBuilding
panel.Margin = new Padding(0);
panel.FillWith((IView) buildingBlockSelection);
panel.BorderStyle = BorderStyles.NoBorder;
var size = new Size(layoutControlItem.Size.Width, CoreConstants.UI.BUILDING_BLOCK_SELECTION_SIZE);
var size = new Size(layoutControlItem.Size.Width, UIConstants.Size.BUILDING_BLOCK_SELECTION_SIZE);
layoutControlItem.SizeConstraintsType = SizeConstraintsType.Custom;
layoutControlItem.MinSize = size;
layoutControlItem.Size = size;
Expand Down
4 changes: 2 additions & 2 deletions src/PKSim.UI/Extensions/TablePanelExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ public static TablePanel WithButtonWidth(this TablePanel tablePanel, params int[

public static void AdjustButtonWithImageOnly(this SimpleButton button)
{
button.Size = new Size(UIConstants.Size.ScaleForScreenDPI(24), UIConstants.Size.ScaleForScreenDPI(22));
button.Size = new Size(OSPSuite.UI.UIConstants.Size.ScaleForScreenDPI(24), OSPSuite.UI.UIConstants.Size.ScaleForScreenDPI(22));
}
public static void AdjustLongButtonWidth(this SimpleButton button)
{
button.Size = new Size(UIConstants.Size.LARGE_BUTTON_WIDTH, button.Height);
button.Size = new Size(OSPSuite.UI.UIConstants.Size.LARGE_BUTTON_WIDTH, button.Height);
}
}
}
42 changes: 42 additions & 0 deletions src/PKSim.UI/UIConstants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using static OSPSuite.UI.UIConstants.Size;

namespace PKSim.UI
{
public static class UIConstants
{
public static class Size
{
public static readonly int BUILDING_BLOCK_SELECTION_SIZE = 32;
public static readonly int PARAMETER_WIDTH = 110;
public static readonly int DATA_SOURCE_WIDTH = 180;

public static readonly int SIMULATION_SETTINGS_WIDTH = ScaleForScreenDPI(750);
public static readonly int SIMULATION_SETTINGS_HEIGHT = ScaleForScreenDPI(650);

public static readonly int INDIVIDUAL_VIEW_WIDTH = ScaleForScreenDPI(880);
public static readonly int INDIVIDUAL_VIEW_HEIGHT = ScaleForScreenDPI(780);

public static readonly int CONFIGURE_SIMULATION_VIEW_HEIGHT = ScaleForScreenDPI(708);
public static readonly int CREATE_SIMULATION_VIEW_HEIGHT = ScaleForScreenDPI(750);
public static readonly int SIMULATION_VIEW_WIDTH = ScaleForScreenDPI(700);

public static readonly int EXPRESSION_QUERY_VIEW_HEIGHT = ScaleForScreenDPI(900);
public static readonly int EXPRESSION_QUERY_VIEW_WIDTH = ScaleForScreenDPI(1100);

public static readonly int FORMULATION_VIEW_WIDTH = ScaleForScreenDPI(650);
public static readonly int FORMULATION_VIEW_HEIGHT = ScaleForScreenDPI(760);

public static readonly int OBSERVER_VIEW_HEIGHT = ScaleForScreenDPI(760);
public static readonly int OBSERVER_VIEW_WIDTH = ScaleForScreenDPI(650);

public static readonly int PROTOCOL_VIEW_WIDTH = ScaleForScreenDPI(700);
public static readonly int PROTOCOL_VIEW_HEIGHT = ScaleForScreenDPI(760);

public static readonly int EXPRESSION_PROFILE_VIEW_HEIGHT = ScaleForScreenDPI(900);
public static readonly int EXPRESSION_PROFILE_VIEW_WIDTH = ScaleForScreenDPI(760);

public static readonly int COMPOUND_VIEW_HEIGHT = ScaleForScreenDPI(900);
public static readonly int COMPOUND_VIEW_WIDTH = ScaleForScreenDPI(760);
}
}
}
12 changes: 6 additions & 6 deletions src/PKSim.UI/UserSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,30 +209,30 @@ public string TemplateDatabasePath

public IconSize IconSizeTab
{
get => UIConstants.ICON_SIZE_TAB;
get => OSPSuite.UI.UIConstants.ICON_SIZE_TAB;
set
{
UIConstants.ICON_SIZE_TAB = value;
OSPSuite.UI.UIConstants.ICON_SIZE_TAB = value;
OnPropertyChanged(() => IconSizeTab);
}
}

public IconSize IconSizeTreeView
{
get => UIConstants.ICON_SIZE_TREE_VIEW;
get => OSPSuite.UI.UIConstants.ICON_SIZE_TREE_VIEW;
set
{
UIConstants.ICON_SIZE_TREE_VIEW = value;
OSPSuite.UI.UIConstants.ICON_SIZE_TREE_VIEW = value;
OnPropertyChanged(() => IconSizeTreeView);
}
}

public IconSize IconSizeContextMenu
{
get => UIConstants.ICON_SIZE_CONTEXT_MENU;
get => OSPSuite.UI.UIConstants.ICON_SIZE_CONTEXT_MENU;
set
{
UIConstants.ICON_SIZE_CONTEXT_MENU = value;
OSPSuite.UI.UIConstants.ICON_SIZE_CONTEXT_MENU = value;
OnPropertyChanged(() => IconSizeContextMenu);
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/PKSim.UI/Views/Applications/ApplicationParametersView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using PKSim.Presentation.DTO.Applications;
using PKSim.Presentation.Presenters.Applications;
using PKSim.Presentation.Views.Applications;
using static OSPSuite.UI.UIConstants.Size;
using BaseView = DevExpress.XtraGrid.Views.Base.BaseView;

namespace PKSim.UI.Views.Applications
Expand Down Expand Up @@ -114,7 +115,7 @@ private void initParameterBinding(GridViewBinder<IParameterDTO> parameterBinder)

parameterBinder.Bind(x => x.IsFavorite)
.WithCaption(PKSimConstants.UI.Favorites)
.WithFixedWidth(UIConstants.Size.EMBEDDED_CHECK_BOX_WIDTH)
.WithFixedWidth(EMBEDDED_CHECK_BOX_WIDTH)
.WithRepository(x => new UxRepositoryItemCheckEdit(parameterBinder.GridView))
.WithToolTip(PKSimConstants.UI.FavoritesToolTip)
.WithOnValueUpdating((o, e) => OnEvent(() => _presenter.SetFavorite(o, e.NewValue)));
Expand Down
2 changes: 1 addition & 1 deletion src/PKSim.UI/Views/BuildingBlockSelectionView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ private void initializeResource()
layoutItemLoad.AdjustButtonSizeWithImageOnly();
layoutItemCreate.AdjustButtonSizeWithImageOnly();
//Make combo box same size as button
layoutItemBuildingBlock.AdjustSize(0, UIConstants.Size.BUTTON_HEIGHT);
layoutItemBuildingBlock.AdjustSize(0, OSPSuite.UI.UIConstants.Size.BUTTON_HEIGHT);
cbBuildingBlocks.Properties.AllowHtmlDraw = DefaultBoolean.True;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
using OSPSuite.DataBinding.DevExpress;
using OSPSuite.DataBinding.DevExpress.XtraGrid;
using OSPSuite.Presentation.Views;
using OSPSuite.UI;
using OSPSuite.UI.Binders;
using OSPSuite.UI.Controls;
using OSPSuite.UI.Extensions;
Expand All @@ -25,6 +24,7 @@
using PKSim.Presentation.Presenters.Compounds;
using PKSim.Presentation.Views.Compounds;
using PKSim.UI.Views.Core;
using static OSPSuite.UI.UIConstants.Size;

namespace PKSim.UI.Views.Compounds
{
Expand All @@ -45,7 +45,6 @@ public partial class CompoundParameterWithDefaultAlternativeBaseView<TParameterA
protected readonly ComboBoxUnitParameter _comboBoxUnit;
protected readonly GridViewBinder<TParameterAlternativeDTO> _gridViewBinder;
private IGridViewColumn _colButtons;


public CompoundParameterWithDefaultAlternativeBaseView()
{
Expand Down Expand Up @@ -89,16 +88,16 @@ public override void InitializeBinding()
var colDefault = _gridViewBinder.Bind(x => x.IsDefault)
.WithCaption(PKSimConstants.UI.IsDefault)
.WithRepository(dto => _isDefaultRepository)
.WithFixedWidth(UIConstants.Size.EMBEDDED_CHECK_BOX_WIDTH);
.WithFixedWidth(EMBEDDED_CHECK_BOX_WIDTH);

colDefault.OnValueUpdating += (o, e) => OnEvent(() => _presenter.SetIsDefaultFor(o, e.NewValue));
_colDefault = colDefault;

_colButtons = _gridViewBinder.AddUnboundColumn()
_colButtons = _gridViewBinder.AddUnboundColumn()
.WithCaption(PKSimConstants.UI.EmptyColumn)
.WithShowButton(ShowButtonModeEnum.ShowAlways)
.WithRepository(GetButtonRepository)
.WithFixedWidth(UIConstants.Size.EMBEDDED_BUTTON_WIDTH * 2);
.WithFixedWidth(EMBEDDED_BUTTON_WIDTH * 2);

_addAndRemoveButtonRepository.ButtonClick += (o, e) => OnEvent(() => buttonRepositoryButtonClick(e, _gridViewBinder.FocusedElement));
_addButtonRepository.ButtonClick += (o, e) => OnEvent(() => _presenter.AddAlternative());
Expand All @@ -112,7 +111,6 @@ protected override bool ColumnIsButton(GridColumn column)
return Equals(_colButtons?.XtraColumn, column);
}


protected override bool ColumnIsCheckBox(GridColumn column)
{
return Equals(_colDefault?.XtraColumn, column);
Expand Down
3 changes: 2 additions & 1 deletion src/PKSim.UI/Views/Compounds/CompoundTypeGroupView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
using PKSim.Presentation.Services;
using PKSim.Presentation.Views.Compounds;
using PKSim.UI.Views.Core;
using static OSPSuite.UI.UIConstants.Size;

namespace PKSim.UI.Views.Compounds
{
Expand Down Expand Up @@ -84,7 +85,7 @@ public override void InitializeBinding()

_colFavorites = _gridViewBinder.Bind(x => x.IsFavorite)
.WithCaption(PKSimConstants.UI.Favorites)
.WithFixedWidth(UIConstants.Size.EMBEDDED_CHECK_BOX_WIDTH)
.WithFixedWidth(EMBEDDED_CHECK_BOX_WIDTH)
.WithRepository(x => _favoriteRepository)
.WithToolTip(PKSimConstants.UI.FavoritesToolTip)
.WithOnValueUpdating((o, e) => OnEvent(() => compoundTypeGroupPresenter.SetFavorite(o, e.NewValue)));
Expand Down
2 changes: 2 additions & 0 deletions src/PKSim.UI/Views/Compounds/CreateCompoundView.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Drawing;
using PKSim.Assets;
using OSPSuite.Assets;
using PKSim.Presentation.Presenters.Compounds;
Expand All @@ -12,6 +13,7 @@ public partial class CreateCompoundView : BuildingBlockWizardView, ICreateCompou
public CreateCompoundView(Shell shell) : base(shell)
{
InitializeComponent();
ClientSize = new Size(UIConstants.Size.COMPOUND_VIEW_WIDTH, UIConstants.Size.COMPOUND_VIEW_HEIGHT);
}

public void AttachPresenter(ICreateCompoundPresenter presenter)
Expand Down
3 changes: 2 additions & 1 deletion src/PKSim.UI/Views/Compounds/FractionUnboundGroupView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using OSPSuite.Presentation.Extensions;
using OSPSuite.UI.Binders;
using PKSim.Core.Model;
using static OSPSuite.UI.UIConstants.Size;
using UIConstants = OSPSuite.UI.UIConstants;

namespace PKSim.UI.Views.Compounds
Expand Down Expand Up @@ -100,7 +101,7 @@ public override void InitializeResources()
Control = _rgPlasmaBindingPartner,
Text = PKSimConstants.UI.FractionUnboundBindingType.FormatForLabel()
};
_layoutItemBindingMode.AdjustControlHeight(UIConstants.Size.RADIO_GROUP_HEIGHT);
_layoutItemBindingMode.AdjustControlHeight(RADIO_GROUP_HEIGHT);
_layoutItemBindingMode.Move(layoutItemGrid, InsertType.Top);
_rgPlasmaBindingPartner.SelectedIndexChanged += (o, e) => OnEvent(bindingPartnerChanged);
}
Expand Down
3 changes: 2 additions & 1 deletion src/PKSim.UI/Views/Core/BuildingBlockWizardView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using OSPSuite.UI;
using OSPSuite.UI.Extensions;
using OSPSuite.UI.Views;
using static OSPSuite.UI.UIConstants.Size;

namespace PKSim.UI.Views.Core
{
Expand Down Expand Up @@ -34,7 +35,7 @@ public override void InitializeResources()
{
base.InitializeResources();
layoutItemName.Text = PKSimConstants.UI.Name.FormatForLabel();
this.ReziseForCurrentScreen(fractionHeight: UIConstants.Size.SCREEN_RESIZE_FRACTION, fractionWidth: UIConstants.Size.SCREEN_RESIZE_FRACTION);
this.ReziseForCurrentScreen(fractionHeight: SCREEN_RESIZE_FRACTION, fractionWidth: SCREEN_RESIZE_FRACTION);
}

public virtual void BindToProperties(ObjectBaseDTO populationPropertiesDTO)
Expand Down
2 changes: 1 addition & 1 deletion src/PKSim.UI/Views/Formulations/CreateFormulationView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public partial class CreateFormulationView : BuildingBlockContainerView, ICreate
public CreateFormulationView(Shell shell) : base(shell)
{
InitializeComponent();
ClientSize = new Size(CoreConstants.UI.FORMULATION_VIEW_WIDTH, CoreConstants.UI.FORMULATION_VIEW_HEIGHT);
ClientSize = new Size(UIConstants.Size.FORMULATION_VIEW_WIDTH, UIConstants.Size.FORMULATION_VIEW_HEIGHT);
}

public void AttachPresenter(ICreateFormulationPresenter presenter)
Expand Down
2 changes: 1 addition & 1 deletion src/PKSim.UI/Views/Individuals/CreateIndividualView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public partial class CreateIndividualView : BuildingBlockWizardView, ICreateIndi
public CreateIndividualView(Shell shell) : base(shell)
{
InitializeComponent();
ClientSize = new Size(CoreConstants.UI.INDIVIDUAL_VIEW_WIDTH, CoreConstants.UI.INDIVIDUAL_VIEW_HEIGHT);
ClientSize = new Size(UIConstants.Size.INDIVIDUAL_VIEW_WIDTH, UIConstants.Size.INDIVIDUAL_VIEW_HEIGHT);
}

public void AttachPresenter(ICreateIndividualPresenter presenter)
Expand Down
Loading

0 comments on commit 7b88ea2

Please sign in to comment.