Changeset 4477 for extensions/pLoader


Ignore:
Timestamp:
Dec 13, 2009, 5:17:20 PM (14 years ago)
Author:
ronosman
Message:

Feature 1321 added : display and modify photo create date with a date picker widget in photo properties panel.

Location:
extensions/pLoader/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/pLoader/trunk/res/photo_properties_wdr.pl

    r4476 r4477  
    1717use Wx qw( wxVERTICAL wxHORIZONTAL wxALL wxLEFT wxRIGHT wxTOP wxBOTTOM wxCENTRE wxGROW );
    1818use Wx qw( wxALIGN_RIGHT wxALIGN_BOTTOM wxALIGN_CENTER wxALIGN_CENTER_VERTICAL wxALIGN_CENTER_HORIZONTAL );
    19 use Wx qw( wxTE_MULTILINE );
     19use Wx qw( wxTE_MULTILINE wxDP_DROPDOWN );
    2020
    2121# Bitmap functions
     
    6767    $item2->AddWindow( $item9, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 );
    6868
    69     my( $item10 ) = Wx::TextCtrl->new( $parent, $main::PHOTO_PROPERTIES_CREATE_DATE, "", wxDefaultPosition, [200,-1], 0 );
     69    my( $item10 ) = Wx::DatePickerCtrl->new( $parent, $main::PHOTO_PROPERTIES_CREATE_DATE, Wx::DateTime->new(), wxDefaultPosition, [200,-1], wxDP_DROPDOWN );
    7070    $item2->AddWindow( $item10, 0, wxALIGN_CENTER_VERTICAL, 5 );
    7171
  • extensions/pLoader/trunk/src/Uploader/GUI/DlgCommon.pm

    r4476 r4477  
    11package Uploader::GUI::DlgCommon;
    22use strict;
     3use Wx::Calendar;
    34
    45use base qw/
     
    1920            'Wx::TextCtrl' => sub { my ( $ctrl ) = @_; Wx::Event::EVT_TEXT( $ctrl, $ctrl, sub { $self->OnTextCtrl(@_) } ); },
    2021            'Wx::Choice' => sub { my ( $ctrl ) = @_; Wx::Event::EVT_CHOICE( $ctrl, $ctrl, sub { $self->OnChoice(@_) } ); },
     22            'Wx::DatePickerCtrl' => sub { my ( $ctrl ) = @_; Wx::Event::EVT_DATE_CHANGED( $ctrl, $ctrl, sub { $self->OnDatePicker(@_) } ); },
    2123        };
    2224       
     
    6365}
    6466
     67sub OnDatePicker {
     68    my ( $self, $ctrl, $event ) = @_;
     69       
     70    my $id = $ctrl->GetId;
     71
     72    # change the property value
     73        $self->properties->{$id}->{value}->(
     74        $event->GetDate->FormatISODate
     75    ) if exists $self->properties->{$id}->{value};
     76    # exec the callback
     77    $self->properties->{$id}->{frame_callback}->() if exists
     78        $self->properties->{$id}->{frame_callback};     
     79       
     80}
     81
    6582
    6683my $change_value = {
    6784    'Wx::TextCtrl' => sub { my ($ctrl, $value ) = @_; $ctrl->ChangeValue($value)},
    6885    'Wx::CheckBox' => sub { my ($ctrl, $value ) = @_; $ctrl->SetValue($value)},
     86    'Wx::DatePickerCtrl' => sub { my ($ctrl, $value ) = @_;
     87                                  my $date = Wx::DateTime->new;
     88                                  my ($yyyy, $mm, $dd, $hh, $mi, $ss ) = split(/[:\/\\\-\.\s]/, $value);
     89                                                                  $date->ParseDate(
     90                                                                      sprintf("%s/%s/%s", $yyyy, $mm, $dd)
     91                                                                  );
     92                                      $ctrl->SetValue($date);
     93                                    },
    6994};     
    7095
     
    7499        map {
    75100        my $ctrl =$self->FindWindow($_);
    76         #printf("ctrl %s : %s\n", $_, $ctrl);           
    77101        if(defined $ctrl){
    78102                # checkbox, static text
     
    141165        if(defined $ctrl){
    142166                # checkbox, static text
     167            $self->properties->{$_}->{value}->(
     168                $ctrl->GetValue()
     169                    ) if exists $self->properties->{$_}->{value};
    143170
    144         $self->properties->{$_}->{value}->(
    145             $ctrl->GetValue()
    146                 ) if exists $self->properties->{$_}->{value};
    147 
    148         $self->properties->{$_}->{selection}->(
    149                     $ctrl->GetSelection()                       
    150                 ) if exists $self->properties->{$_}->{selection};
    151                
    152                 printf("selection %s\n", $ctrl->GetSelection())if exists $self->properties->{$_}->{selection};
    153                
     171            $self->properties->{$_}->{selection}->(
     172                        $ctrl->GetSelection()                   
     173                    ) if exists $self->properties->{$_}->{selection};
    154174                }
    155175    }
  • extensions/pLoader/trunk/src/Uploader/GUI/wxPhotoProperties.pm

    r4476 r4477  
    2323             wxDefaultSize
    2424             wxDefaultPosition
     25                         wxTAB_TRAVERSAL
    2526             wxID_CANCEL
    2627             wxID_OK
     
    4344
    4445#    my $self = $class->SUPER::new( $params->{parentwnd}, -1, wxDefaultPosition, [600, 350]);
    45     my $self = $class->SUPER::new( $params->{parentwnd}, -1, wxDefaultPosition, wxDefaultSize);
     46    my $self = $class->SUPER::new( $params->{parentwnd}, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
    4647        #$self->SetMinSize([600, 350]);
    4748    # load controls
  • extensions/pLoader/trunk/src/Uploader/Image.pm

    r4476 r4477  
    4545sub Init {
    4646    my ( $self ) = @_;
     47
    4748}
    4849
     
    5657
    5758sub create_date {
    58     my ( $self ) = @_;
     59    my ( $self, $date ) = @_;
    5960   
    6061    my $exif = $self->exif_metadata ;
    61    
    62     $exif->{CreateDate};       
     62   
     63    $self->{-create_date} ||= $exif->{CreateDate};
     64       
     65    $self->{-create_date} = $date if defined $date;
     66
     67        $self->{-create_date};
    6368}
    6469
Note: See TracChangeset for help on using the changeset viewer.