[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[6256] addons/1.3/wxPOS/scripts



Revision: 6256
          http://sourceforge.net/p/ledger-smb/code/6256
Author:   einhverfr
Date:     2013-11-08 05:31:10 +0000 (Fri, 08 Nov 2013)
Log Message:
-----------
Beginning refactor of UI elements into separate namespaces.  Removed unused scripts/LoginWx.pm and moved scripts/Login.pm to scripts/WXPOS/UI/

Modified Paths:
--------------
    addons/1.3/wxPOS/scripts/AR.pm
    addons/1.3/wxPOS/scripts/Console.pm

Added Paths:
-----------
    addons/1.3/wxPOS/scripts/WXPOS/UI/
    addons/1.3/wxPOS/scripts/WXPOS/UI/Login.pm

Removed Paths:
-------------
    addons/1.3/wxPOS/scripts/Login.pm
    addons/1.3/wxPOS/scripts/LoginWx.pm

Modified: addons/1.3/wxPOS/scripts/AR.pm
===================================================================
--- addons/1.3/wxPOS/scripts/AR.pm	2013-11-08 05:13:33 UTC (rev 6255)
+++ addons/1.3/wxPOS/scripts/AR.pm	2013-11-08 05:31:10 UTC (rev 6256)
@@ -82,7 +82,7 @@
  EVT_LIST_ITEM_SELECTED($self->{tab}, $self->{list}, sub{$self->_selParts});
  EVT_LIST_ITEM_DESELECTED($self->{tab}, $self->{list}, sub{$self->_selParts});
 
-### Post
+### Pay
  Wx::StaticLine->new($self->{tab}, -1, [0, 490], [800, 2], wxLI_HORIZONTAL);
  Wx::StaticText->new($self->{tab}, -1, 'Net: ', [100, 500], [90, 24]);
  $self->{net_total} = Wx::StaticText->new($self->{tab}, -1, '', [200, 500], [90, 24]);
@@ -90,8 +90,8 @@
  $self->{tax_total} = Wx::StaticText->new($self->{tab}, -1, '', [400, 500], [90, 24]);
  Wx::StaticText->new($self->{tab}, -1, 'Total: ', [500, 500], [90, 24]);
  $self->{total} = Wx::StaticText->new($self->{tab}, -1, '', [600, 500], [90, 24]);
- my $invoice_post = Wx::Button->new($self->{tab}, -1, 'Post', [700, 500], [90, 24]);
- EVT_BUTTON($self->{tab}, $invoice_post, sub{$self->_InvoicePost});
+ my $invoice_post = Wx::Button->new($self->{tab}, -1, 'Pay', [700, 500], [90, 24]);
+ EVT_BUTTON($self->{tab}, $invoice_post, sub{$self->_InvoicePay});
 
 ## Finishing
  if ($dft_custom){
@@ -266,7 +266,7 @@
  return 1;
 }
 
-sub _InvoicePost {
+sub _InvoicePay {
  my($self) = @_;
  Wx::MessageBox("At this point we should be able to track each account and the account to set.", "DEBUG", wxOK|wxCENTRE|wxICON_ERROR, $self->{tab});
  return 1;

Modified: addons/1.3/wxPOS/scripts/Console.pm
===================================================================
--- addons/1.3/wxPOS/scripts/Console.pm	2013-11-08 05:13:33 UTC (rev 6255)
+++ addons/1.3/wxPOS/scripts/Console.pm	2013-11-08 05:31:10 UTC (rev 6256)
@@ -58,8 +58,8 @@
 
 ### First at all, login, get a db handler and other stuff initialized by Login dialog as sesion.
 #
- use Login;
- my $login = Login->new();
+ use WXPOS::UI::Login;
+ my $login = WXPOS::UI::Login->new();
  if ($login->ShowModal()) {
   die();
  }

Deleted: addons/1.3/wxPOS/scripts/Login.pm
===================================================================
--- addons/1.3/wxPOS/scripts/Login.pm	2013-11-08 05:13:33 UTC (rev 6255)
+++ addons/1.3/wxPOS/scripts/Login.pm	2013-11-08 05:31:10 UTC (rev 6256)
@@ -1,96 +0,0 @@
-=head1 NAME
-
-LedgerSMB - Wx Login
-
-=head1 SYNOPSIS
-
-This is a dialog that will pop up at start asking about user, pass and company. This credential is used to get a database handler.
-
-=head1 METHODS
-
-=over
-
-=item new ()
-
-This method creates a new Dialog showing an intro login screen. From the class, ShowModal is used to keep the dialog up till a valid handler is created.
-
-=item Login ()
-
-It is an event function that get the text on the fields and tries a connection to the database.
-If the connection is made, it will be saved under ldb key and EndModal with a return 0 code will
-be trigged so the conditional on console.pm will avoid die.
-
-=back
-
-=head1 AUTHOR
-
-Andres Basile (..hidden..)
-
-=cut
-
-package Login;
-
-use base qw(Wx::Dialog);
-use Wx::Event qw(EVT_BUTTON);
-use Wx qw(wxDefaultPosition wxDefaultSize wxOK wxCENTRE wxTE_PASSWORD wxCLOSE_BOX wxBITMAP_TYPE_PNG);
-
-use LSMBDB;
-use WXPOS::User;
-use WXPOS::Sysconfig;
-
-sub new {
- my ($class) = @_;
- my $self = Wx::Dialog->new(undef , -1, "LedgerSMB", wxDefaultPosition, [300, 320]);
- bless $self, $class;
- $self->{WxPanel} = Wx::Panel->new($self, -1, wxDefaultPosition, [300, 320]);
- Wx::InitAllImageHandlers();
- $self->{sesion}->{logo} =  Wx::Bitmap->new("ledgersmb.png", wxBITMAP_TYPE_PNG);
- Wx::StaticBitmap->new($self->{WxPanel}, -1, $self->{sesion}->{logo}, [50, 10], [200, 100]);
- Wx::StaticText->new($self->{WxPanel}, -1, 'User', [50, 120], [80, 24]);
- my $user = $WXPOS::Sysconfig::dbconfig->{user} || '';
- $self->{user} = Wx::TextCtrl->new($self->{WxPanel}, -1, $user, [130, 120], [120, 24]);
- Wx::StaticText->new($self->{WxPanel}, -1, 'Password', [50, 160], [90, 24]);
- $self->{pass} = Wx::TextCtrl->new($self->{WxPanel}, -1, $WXPOS::Sysconfig::dbconfig->{password} || '', [130, 160], [120, 24], wxTE_PASSWORD);
- Wx::StaticText->new($self->{WxPanel}, -1, 'Company', [50, 200], [90, 30]);
- $self->{comp} = Wx::TextCtrl->new($self->{WxPanel}, -1, $WXPOS::Sysconfig::dbconfig->{database} || '', [130, 200], [120, 24]);
- Wx::StaticText->new($self->{WxPanel}, -1, 'Server', [50, 240], [90, 30]);
- $self->{serv} = Wx::TextCtrl->new($self->{WxPanel}, -1, $WXPOS::Sysconfig::dbconfig->{host} || '', [130, 240], [120, 24]);
- my $button = Wx::Button->new($self->{WxPanel}, -1, 'Enter', [100, 280], [100, 24]);
- EVT_BUTTON($self, $button, \&Login);
- my $exitbtn =  Wx::Button->new($self->{WxPanel}, -1, 'X', [250, 280], [20, 24]);
- EVT_BUTTON($self, $exitbtn, \&AbortLogin);
- return $self;
-}
-
-sub Login {
- my($self, $event) = @_;
- $self->{sesion}->{user} = $self->{user}->GetValue();
- $self->{sesion}->{comp} = $self->{comp}->GetValue();
- $self->{sesion}->{serv} = $self->{serv}->GetValue();
- my $pass = $self->{pass}->GetValue();
-
- $self->{sesion}->{ldb} = LSMBDB->new(
-         $self->{sesion}->{user}, $pass, $self->{sesion}->{comp}, 
-         $self->{sesion}->{serv}
- );
-
- if ( $self->{sesion}->{ldb} ) {
-  $self->{sesion}->{user_info} = WXPOS::User->get_current;
-  if ($self->{sesion}->{user_info}) {
-   $self->EndModal(0);
-  }
-  else {
-   Wx::MessageBox("User exists on database but has not WX profile.\nPlease add a new entity_note on the employee.\nSee README for details.", "Login Error!", wxOK|wxCENTRE, $self);
-  }
- }
- else {
-  Wx::MessageBox("Please, try again.", "Login Error!", wxOK|wxCENTRE, $self);
- }
- return $self;
-}
-
-sub AbortLogin {
-  die 'Login Aborted';
-}
-
-1;

Deleted: addons/1.3/wxPOS/scripts/LoginWx.pm
===================================================================
--- addons/1.3/wxPOS/scripts/LoginWx.pm	2013-11-08 05:13:33 UTC (rev 6255)
+++ addons/1.3/wxPOS/scripts/LoginWx.pm	2013-11-08 05:31:10 UTC (rev 6256)
@@ -1,35 +0,0 @@
-package LoginWx;
-
-use base qw(Wx::Dialog);
-use Wx::Event qw(EVT_BUTTON);
-use Wx qw(wxDefaultPosition wxDefaultSize wxOK wxCENTRE wxTE_PASSWORD wxCLOSE_BOX);
-
-sub new {
- my ($class) = @_;
- my $self = Wx::Dialog->new(undef , -1, "LedgerSMB", wxDefaultPosition, [200, 200], wxCLOSE_BOX);
- my $panel = Wx::Panel->new($self, -1, wxDefaultPosition, [200, 200]);
- my $button = Wx::Button->new($panel, -1, 'Enter', [50, 160], [100, 20]);
- $self->{user} = Wx::TextCtrl->new($panel, -1, 'postgres', [50, 100], [100, 20]);
- $self->{pass} = Wx::TextCtrl->new($panel, -1, '', [50, 120], [100, 20], wxTE_PASSWORD);
- $self->{comp} = Wx::TextCtrl->new($panel, -1, 'database', [50, 140], [100, 20]);
- EVT_BUTTON($self, $button, \&Login);
- return $self;
-}
-
-sub Login {
- my($self, $event) = @_;
- my $value = {};
- my $user = $self->{user}->GetValue();
- my $pass = $self->{pass}->GetValue();
- my $comp = $self->{comp}->GetValue();
- use DBI;
- $self->{dbh} = DBI->connect("dbi:Pg:dbname=$comp;host=localhost", $user, $pass, {RaiseError => 0, AutoCommit => 0});
- if ( $self->{'dbh'} ) {
-  $self->EndModal($self);
- }
- else {
-  Wx::MessageBox("Please, try again.", "Login Error!", wxOK|wxCENTRE, $self);
- }
- return 1;
-}
-1;

Copied: addons/1.3/wxPOS/scripts/WXPOS/UI/Login.pm (from rev 6245, addons/1.3/wxPOS/scripts/Login.pm)
===================================================================
--- addons/1.3/wxPOS/scripts/WXPOS/UI/Login.pm	                        (rev 0)
+++ addons/1.3/wxPOS/scripts/WXPOS/UI/Login.pm	2013-11-08 05:31:10 UTC (rev 6256)
@@ -0,0 +1,96 @@
+=head1 NAME
+
+LedgerSMB - Wx Login
+
+=head1 SYNOPSIS
+
+This is a dialog that will pop up at start asking about user, pass and company. This credential is used to get a database handler.
+
+=head1 METHODS
+
+=over
+
+=item new ()
+
+This method creates a new Dialog showing an intro login screen. From the class, ShowModal is used to keep the dialog up till a valid handler is created.
+
+=item Login ()
+
+It is an event function that get the text on the fields and tries a connection to the database.
+If the connection is made, it will be saved under ldb key and EndModal with a return 0 code will
+be trigged so the conditional on console.pm will avoid die.
+
+=back
+
+=head1 AUTHOR
+
+Andres Basile (..hidden..)
+
+=cut
+
+package WXPOS::UI::Login;
+
+use base qw(Wx::Dialog);
+use Wx::Event qw(EVT_BUTTON);
+use Wx qw(wxDefaultPosition wxDefaultSize wxOK wxCENTRE wxTE_PASSWORD wxCLOSE_BOX wxBITMAP_TYPE_PNG);
+
+use LSMBDB;
+use WXPOS::User;
+use WXPOS::Sysconfig;
+
+sub new {
+ my ($class) = @_;
+ my $self = Wx::Dialog->new(undef , -1, "LedgerSMB", wxDefaultPosition, [300, 320]);
+ bless $self, $class;
+ $self->{WxPanel} = Wx::Panel->new($self, -1, wxDefaultPosition, [300, 320]);
+ Wx::InitAllImageHandlers();
+ $self->{sesion}->{logo} =  Wx::Bitmap->new("ledgersmb.png", wxBITMAP_TYPE_PNG);
+ Wx::StaticBitmap->new($self->{WxPanel}, -1, $self->{sesion}->{logo}, [50, 10], [200, 100]);
+ Wx::StaticText->new($self->{WxPanel}, -1, 'User', [50, 120], [80, 24]);
+ my $user = $WXPOS::Sysconfig::dbconfig->{user} || '';
+ $self->{user} = Wx::TextCtrl->new($self->{WxPanel}, -1, $user, [130, 120], [120, 24]);
+ Wx::StaticText->new($self->{WxPanel}, -1, 'Password', [50, 160], [90, 24]);
+ $self->{pass} = Wx::TextCtrl->new($self->{WxPanel}, -1, $WXPOS::Sysconfig::dbconfig->{password} || '', [130, 160], [120, 24], wxTE_PASSWORD);
+ Wx::StaticText->new($self->{WxPanel}, -1, 'Company', [50, 200], [90, 30]);
+ $self->{comp} = Wx::TextCtrl->new($self->{WxPanel}, -1, $WXPOS::Sysconfig::dbconfig->{database} || '', [130, 200], [120, 24]);
+ Wx::StaticText->new($self->{WxPanel}, -1, 'Server', [50, 240], [90, 30]);
+ $self->{serv} = Wx::TextCtrl->new($self->{WxPanel}, -1, $WXPOS::Sysconfig::dbconfig->{host} || '', [130, 240], [120, 24]);
+ my $button = Wx::Button->new($self->{WxPanel}, -1, 'Enter', [100, 280], [100, 24]);
+ EVT_BUTTON($self, $button, \&Login);
+ my $exitbtn =  Wx::Button->new($self->{WxPanel}, -1, 'X', [250, 280], [20, 24]);
+ EVT_BUTTON($self, $exitbtn, \&AbortLogin);
+ return $self;
+}
+
+sub Login {
+ my($self, $event) = @_;
+ $self->{sesion}->{user} = $self->{user}->GetValue();
+ $self->{sesion}->{comp} = $self->{comp}->GetValue();
+ $self->{sesion}->{serv} = $self->{serv}->GetValue();
+ my $pass = $self->{pass}->GetValue();
+
+ $self->{sesion}->{ldb} = LSMBDB->new(
+         $self->{sesion}->{user}, $pass, $self->{sesion}->{comp}, 
+         $self->{sesion}->{serv}
+ );
+
+ if ( $self->{sesion}->{ldb} ) {
+  $self->{sesion}->{user_info} = WXPOS::User->get_current;
+  if ($self->{sesion}->{user_info}) {
+   $self->EndModal(0);
+  }
+  else {
+   Wx::MessageBox("User exists on database but has not WX profile.\nPlease add a new entity_note on the employee.\nSee README for details.", "Login Error!", wxOK|wxCENTRE, $self);
+  }
+ }
+ else {
+  Wx::MessageBox("Please, try again.", "Login Error!", wxOK|wxCENTRE, $self);
+ }
+ return $self;
+}
+
+sub AbortLogin {
+  die 'Login Aborted';
+}
+
+1;

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits