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

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



Revision: 6257
          http://sourceforge.net/p/ledger-smb/code/6257
Author:   einhverfr
Date:     2013-11-08 05:37:37 +0000 (Fri, 08 Nov 2013)
Log Message:
-----------
Moving Console.pm to UI.pm, removing unused ConsoleWx.pm

Modified Paths:
--------------
    addons/1.3/wxPOS/LedgerSMB.pl

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

Removed Paths:
-------------
    addons/1.3/wxPOS/scripts/Console.pm
    addons/1.3/wxPOS/scripts/ConsoleWx.pm

Modified: addons/1.3/wxPOS/LedgerSMB.pl
===================================================================
--- addons/1.3/wxPOS/LedgerSMB.pl	2013-11-08 05:31:10 UTC (rev 6256)
+++ addons/1.3/wxPOS/LedgerSMB.pl	2013-11-08 05:37:37 UTC (rev 6257)
@@ -16,7 +16,9 @@
 =cut
 
 use strict;
+use lib "scripts";
 use Wx;
+use WXPOS::UI;
 
 package LsmbWx;
 use base 'Wx::App';
@@ -24,9 +26,7 @@
 sub OnInit {
  my ($class) = @_;
  $class->SetAppName( "LedgerSMB" );
- use lib "scripts";
- use Console;
- my $console = Console->new();
+ my $console = WXPOS::UI->new();
  $console->SetIcon( Wx::GetWxPerlIcon() );
  $console->Show(1);
  $class->SetTopWindow($console);

Deleted: addons/1.3/wxPOS/scripts/Console.pm
===================================================================
--- addons/1.3/wxPOS/scripts/Console.pm	2013-11-08 05:31:10 UTC (rev 6256)
+++ addons/1.3/wxPOS/scripts/Console.pm	2013-11-08 05:37:37 UTC (rev 6257)
@@ -1,147 +0,0 @@
-=head1 NAME
-
-LedgerSMB - Wx Console
-
-=head1 SYNOPSIS
-
-This is the main window, menu and handler for the LedgerSMB Wx client
-
-=head1 METHODS
-
-=over
-
-=item new()
-
-This method creates a new Frame that will work as main window, then it uses Login package poping up
-a small dialog asking for database credentials. Once the database handler is gotten, it will show
-a menu.
-
-=item _load_module()
-
-This is the main handler. It will get from the menu $module and $action in order to init a $module->new($action).
-
-=item $self->{sesion}
-
-This is a hash reference that works as a container for all that variables shared by the whole program. It will be passed as argument to the modules.
-
-Initialized by Login module:
-->{user} = User logged to database.
-->{comp} = Database name.
-->{serv} = Server ip or host where the database is listening.
-->{logo} = Wx bitmap containing LedgerSMB 200x100 logo.
-->{ldb} = LedgerSMB database interface. LSMBDP object with an active connection to database.
-->{user_info} = User full name, etc.
-->{defaults} = This is a hash stored into note table on the database. It would be like WX user defaults and each user should have at least a warehouse assigned in order to work.
-
-Initialized by Console:
-->{nb} = It is the NoteBook object that works as window parent.
-
-=back
-
-=head1 AUTHOR
-
-Andres Basile (..hidden..)
-
-=cut
-
-package Console;
-
-use base qw(Wx::Frame);
-use Wx::Menu;
-use Wx qw(wxDefaultPosition wxDefaultSize wxDEFAULT_FRAME_STYLE wxNO_FULL_REPAINT_ON_RESIZE wxCLIP_CHILDREN wxBITMAP_TYPE_PNG wxMAXIMIZE);
-use Wx::Event qw(EVT_TREE_SEL_CHANGED EVT_CLOSE EVT_IDLE EVT_MENU EVT_KEY_DOWN);
-use WXPOS::Sysconfig;
-
-sub new {
- my ($class) = @_;
- my $self = $class->SUPER::new(undef, -1, 'LedgerSMB', wxDefaultPosition, [800, 600], wxDEFAULT_FRAME_STYLE);
-
-### First at all, login, get a db handler and other stuff initialized by Login dialog as sesion.
-#
- use WXPOS::UI::Login;
- my $login = WXPOS::UI::Login->new();
- if ($login->ShowModal()) {
-  die();
- }
-### Getting my initialized hash sesion with lsmbdb object (an object layer to access db), login options, logo image object
- $self->{sesion} = $login->{sesion};
-###
- $login->Destroy();
-#
-###
-
-### Notebook (tabs), this will be the window parent inside the frame.
-#
- $self->{sesion}->{nb} = Wx::Notebook->new($self, -1, wxDefaultPosition, wxDefaultSize, wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN);
-
- $WXPOS::State::Notebook = $self->{sesion}->{nb};
-
-#
-###
-
-### Menu
-# TODO: It should be loaded/created on demand according to user acl.
- my($ID_FILE, $ID_ABOUT, $ID_EXIT, $ID_AR, $AR_INVOICE, $AR_TRANSACTION, $AR_CUSTOMER, $ID_AP, $ID_IC, $IC_PARTS) = (100 .. 200);
- my $bar = Wx::MenuBar->new;
-
- my $file = Wx::Menu->new;
- $file->Append($ID_ABOUT, "&About");
- EVT_MENU($self, $ID_ABOUT, \&_about);
- $file->Append($ID_EXIT, "&Exit");
- EVT_MENU($self, $ID_EXIT, \&_logout);
- $bar->Append($file, "&File" );
-
- my $ar = Wx::Menu->new;
- $ar->Append($AR_INVOICE, "&Invoice");
- EVT_MENU($self, $AR_INVOICE, sub{$self->_load_module(AR, Invoice)});
- $ar->Append($AR_CUSTOMER, "&Customer");
- EVT_MENU($self, $AR_CUSTOMER, sub{$self->_load_module(AR, Customer)});
- $bar->Append($ar, "&AR" );
-
- my $ic = Wx::Menu->new;
- $ic->Append($IC_PARTS, "&Parts");
- EVT_MENU($self, $IC_PARTS, sub{$self->_load_module(IC, Parts)});
- $bar->Append($ic, "&Inventory" );
-
- $self->SetMenuBar($bar);
- return $self;
-}
-
-sub _process_char {
- my ($evt) = @_;
- warn 'key pressed';
-}
-
-### About
-sub _about {
- my ($self) = @_;
- use Wx qw(wxOK wxCENTRE);
- my $about = Wx::MessageBox("LedgerSMB WX Client\nEmployee: ".$self->{sesion}->{user_info}->{name}."\nWarehouse: ".$self->{sesion}->{defaults}->{wh}, "Version 0.2", wxOK|wxCENTRE, $self);
- return 1;
-}
-
-### Exit
-sub _logout {
- my ($self) = @_;
- $self->SUPER::Close();
-}
-
-### Handler
-sub _load_module {
- my ($self, $module, $action) = @_;
- #$self->{sesion}->{nb}->DeleteAllPages();
- use lib "scripts";
- require $module.".pm";
- my $tab = $module->new($self->{sesion}, $action);
- $self->{sesion}->{nb}->AddPage($tab, $action, 1);
- $tab->Show();
- EVT_KEY_DOWN($tab, sub {$self->_process_char});
- return $self;
-}
-
-###
-sub DESTROY {
- my ($self) = @_;
- $self->{sesion}->{ldb}->{dbh}->disconnect();
-}
-1;

Deleted: addons/1.3/wxPOS/scripts/ConsoleWx.pm
===================================================================
--- addons/1.3/wxPOS/scripts/ConsoleWx.pm	2013-11-08 05:31:10 UTC (rev 6256)
+++ addons/1.3/wxPOS/scripts/ConsoleWx.pm	2013-11-08 05:37:37 UTC (rev 6257)
@@ -1,97 +0,0 @@
-package ConsoleWx;
-
-use base qw(Wx::Frame);
-use Wx::Event;
-use Wx::Menu;
-use Wx qw(wxDefaultPosition wxDefaultSize wxDEFAULT_FRAME_STYLE wxNO_FULL_REPAINT_ON_RESIZE wxCLIP_CHILDREN);
-use Wx::Event qw(EVT_TREE_SEL_CHANGED EVT_CLOSE EVT_IDLE EVT_MENU);
-
-sub new {
- my ($class) = @_;
- my $self = $class->SUPER::new(undef, -1, 'LedgerSMB', wxDefaultPosition, [800, 600]);
-
-### First at all, login and get a db handler
-#
- use LoginWx;
- my $login = LoginWx->new();
- $login->ShowModal();
- $self->{dbh} = $login->{dbh};
- $login->Destroy();
-#
-###
-
-### TODO
-# The idea would be to init LedgerSMB class here.
-# my $sql = "SELECT id, label, parent, position FROM public.menu_node";
-# my $menu_list = $self->{dbh}->selectall_arrayref($sql);
-###
-
-### Notebook (tabs)
-#
- $self->{nb} = Wx::Notebook->new($self, -1, wxDefaultPosition, wxDefaultSize, wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN);
-#
-###
-
-### Menu
-# TODO: It should be loaded/created on demand according to user acl.
-#
- my($ID_FILE, $ID_ABOUT, $ID_EXIT, $ID_AR, $AR_INVOICE, $AR_TRANSACTION, $AR_CUSTOMER, $ID_AP, $ID_IC, $IC_SEARCH) = (100 .. 200);
- my $bar = Wx::MenuBar->new;
-
- my $file = Wx::Menu->new;
- $file->Append($ID_ABOUT, "&About");
- EVT_MENU($self, $ID_ABOUT, \&about);
- $file->Append($ID_EXIT, "&Exit");
- EVT_MENU($self, $ID_EXIT, \&logout);
- $bar->Append($file, "&File" );
-
- my $ar = Wx::Menu->new;
- $ar->Append($AR_INVOICE, "&Invoice");
- EVT_MENU($self, $AR_INVOICE, sub{$self->load_module(AR, Invoice)});
- $ar->Append($AR_CUSTOMER, "&Customer");
- EVT_MENU($self, $AR_CUSTOMER, sub{$self->load_module(AR, Customer)});
- $bar->Append($ar, "&AR" );
-
- my $ic = Wx::Menu->new;
- $ic->Append($IC_SEARCH, "&Search");
- EVT_MENU($self, $IC_SEARCH, sub{$self->load_module(IC, Search)});
- $bar->Append($ic, "&Inventory" );
-
- $self->SetMenuBar($bar);
-#
-###
- return $self;
-}
-
-### Basic Commands
-#
-sub about {
- my ($self) = @_;
- use Wx qw(wxOK wxCENTRE);
- Wx::MessageBox("LedgerSMB WX Client\n", "Version", wxOK|wxCENTRE, $self);
- return 1;
-}
-
-sub logout {
- my ($self) = @_;
- $self->SUPER::Close();
-}
-#
-###
-
-### Handler
-#
-sub load_module {
- my ($self, $module, $action) = @_;
- $self->{nb}->DeleteAllPages();
- use lib "scripts";
- require $module.".pm";
- my $tab = $module->new($self->{dbh}, $self->{nb}, $action);
- warn 'testing...';
- $self->{nb}->AddPage($tab, $module."::".$action);
- $tab->Show();
- return $self;
-}
-#
-###
-1;

Copied: addons/1.3/wxPOS/scripts/WXPOS/UI.pm (from rev 6256, addons/1.3/wxPOS/scripts/Console.pm)
===================================================================
--- addons/1.3/wxPOS/scripts/WXPOS/UI.pm	                        (rev 0)
+++ addons/1.3/wxPOS/scripts/WXPOS/UI.pm	2013-11-08 05:37:37 UTC (rev 6257)
@@ -0,0 +1,147 @@
+=head1 NAME
+
+LedgerSMB - Wx Console
+
+=head1 SYNOPSIS
+
+This is the main window, menu and handler for the LedgerSMB Wx client
+
+=head1 METHODS
+
+=over
+
+=item new()
+
+This method creates a new Frame that will work as main window, then it uses Login package poping up
+a small dialog asking for database credentials. Once the database handler is gotten, it will show
+a menu.
+
+=item _load_module()
+
+This is the main handler. It will get from the menu $module and $action in order to init a $module->new($action).
+
+=item $self->{sesion}
+
+This is a hash reference that works as a container for all that variables shared by the whole program. It will be passed as argument to the modules.
+
+Initialized by Login module:
+->{user} = User logged to database.
+->{comp} = Database name.
+->{serv} = Server ip or host where the database is listening.
+->{logo} = Wx bitmap containing LedgerSMB 200x100 logo.
+->{ldb} = LedgerSMB database interface. LSMBDP object with an active connection to database.
+->{user_info} = User full name, etc.
+->{defaults} = This is a hash stored into note table on the database. It would be like WX user defaults and each user should have at least a warehouse assigned in order to work.
+
+Initialized by Console:
+->{nb} = It is the NoteBook object that works as window parent.
+
+=back
+
+=head1 AUTHOR
+
+Andres Basile (..hidden..)
+
+=cut
+
+package WXPOS::UI;
+
+use base qw(Wx::Frame);
+use Wx::Menu;
+use Wx qw(wxDefaultPosition wxDefaultSize wxDEFAULT_FRAME_STYLE wxNO_FULL_REPAINT_ON_RESIZE wxCLIP_CHILDREN wxBITMAP_TYPE_PNG wxMAXIMIZE);
+use Wx::Event qw(EVT_TREE_SEL_CHANGED EVT_CLOSE EVT_IDLE EVT_MENU EVT_KEY_DOWN);
+use WXPOS::Sysconfig;
+
+sub new {
+ my ($class) = @_;
+ my $self = $class->SUPER::new(undef, -1, 'LedgerSMB', wxDefaultPosition, [800, 600], wxDEFAULT_FRAME_STYLE);
+
+### First at all, login, get a db handler and other stuff initialized by Login dialog as sesion.
+#
+ use WXPOS::UI::Login;
+ my $login = WXPOS::UI::Login->new();
+ if ($login->ShowModal()) {
+  die();
+ }
+### Getting my initialized hash sesion with lsmbdb object (an object layer to access db), login options, logo image object
+ $self->{sesion} = $login->{sesion};
+###
+ $login->Destroy();
+#
+###
+
+### Notebook (tabs), this will be the window parent inside the frame.
+#
+ $self->{sesion}->{nb} = Wx::Notebook->new($self, -1, wxDefaultPosition, wxDefaultSize, wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN);
+
+ $WXPOS::State::Notebook = $self->{sesion}->{nb};
+
+#
+###
+
+### Menu
+# TODO: It should be loaded/created on demand according to user acl.
+ my($ID_FILE, $ID_ABOUT, $ID_EXIT, $ID_AR, $AR_INVOICE, $AR_TRANSACTION, $AR_CUSTOMER, $ID_AP, $ID_IC, $IC_PARTS) = (100 .. 200);
+ my $bar = Wx::MenuBar->new;
+
+ my $file = Wx::Menu->new;
+ $file->Append($ID_ABOUT, "&About");
+ EVT_MENU($self, $ID_ABOUT, \&_about);
+ $file->Append($ID_EXIT, "&Exit");
+ EVT_MENU($self, $ID_EXIT, \&_logout);
+ $bar->Append($file, "&File" );
+
+ my $ar = Wx::Menu->new;
+ $ar->Append($AR_INVOICE, "&Invoice");
+ EVT_MENU($self, $AR_INVOICE, sub{$self->_load_module(AR, Invoice)});
+ $ar->Append($AR_CUSTOMER, "&Customer");
+ EVT_MENU($self, $AR_CUSTOMER, sub{$self->_load_module(AR, Customer)});
+ $bar->Append($ar, "&AR" );
+
+ my $ic = Wx::Menu->new;
+ $ic->Append($IC_PARTS, "&Parts");
+ EVT_MENU($self, $IC_PARTS, sub{$self->_load_module(IC, Parts)});
+ $bar->Append($ic, "&Inventory" );
+
+ $self->SetMenuBar($bar);
+ return $self;
+}
+
+sub _process_char {
+ my ($evt) = @_;
+ warn 'key pressed';
+}
+
+### About
+sub _about {
+ my ($self) = @_;
+ use Wx qw(wxOK wxCENTRE);
+ my $about = Wx::MessageBox("LedgerSMB WX Client\nEmployee: ".$self->{sesion}->{user_info}->{name}."\nWarehouse: ".$self->{sesion}->{defaults}->{wh}, "Version 0.2", wxOK|wxCENTRE, $self);
+ return 1;
+}
+
+### Exit
+sub _logout {
+ my ($self) = @_;
+ $self->SUPER::Close();
+}
+
+### Handler
+sub _load_module {
+ my ($self, $module, $action) = @_;
+ #$self->{sesion}->{nb}->DeleteAllPages();
+ use lib "scripts";
+ require $module.".pm";
+ my $tab = $module->new($self->{sesion}, $action);
+ $self->{sesion}->{nb}->AddPage($tab, $action, 1);
+ $tab->Show();
+ EVT_KEY_DOWN($tab, sub {$self->_process_char});
+ return $self;
+}
+
+###
+sub DESTROY {
+ my ($self) = @_;
+ $self->{sesion}->{ldb}->{dbh}->disconnect();
+}
+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