PageRenderTime 64ms CodeModel.GetById 29ms RepoModel.GetById 0ms app.codeStats 0ms

/core/promogest/ui/PanUi.py

http://promogest.googlecode.com/
Python | 161 lines | 117 code | 21 blank | 23 comment | 14 complexity | 4c2ec738eb3d36b2f689dbef7d66bfb7 MD5 | raw file
Possible License(s): GPL-2.0
  1. # -*- coding: utf-8 -*-
  2. # Promogest
  3. #
  4. # Copyright (C) 2005-2009 by Promotux Informatica - http://www.promotux.it/
  5. # Author: Francesco Meloni <francesco@promotux.it>
  6. #
  7. # This program is free software; you can redistribute it and/or
  8. # modify it under the terms of the GNU General Public License
  9. # as published by the Free Software Foundation; either version 2
  10. # of the License, or (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program; if not, write to the Free Software
  19. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  20. from promogest.ui.gtk_compat import *
  21. import hashlib
  22. from threading import Timer
  23. from promogest.ui.utils import orda, messageInfo, setconf
  24. from promogest.dao.Setconf import SetConf
  25. from promogest import Environment
  26. from GladeWidget import GladeWidget
  27. import webbrowser
  28. import datetime
  29. import urllib, urllib2
  30. try:
  31. import json
  32. except:
  33. None
  34. def checkPan(main):
  35. print "TIPO PG", Environment.tipo_pg, Environment.modulesList, ("FULL" not in Environment.modulesList)
  36. for a in Environment.modulesList:
  37. if a:
  38. if ("FULL" in a) or ("STANDARD" in a) or ("PRO" in a):
  39. text = "OPZIONE: <b>%s</b>" %(Environment.tipo_pg)
  40. main.pan_label_info.set_markup(text)
  41. Environment.pg2log.info(text)
  42. if "+S" in a:
  43. print "ATTIVARE SHOP"
  44. if not setconf("VenditaDettaglio","mod_enable",value="yes"):
  45. a = SetConf()
  46. a.section = "VenditaDettaglio"
  47. a.tipo_section ="Modulo"
  48. a.description = "Modulo Vendita Dettaglio"
  49. a.tipo = "bool"
  50. a.key = "mod_enable"
  51. a.value = "yes"
  52. a.persist()
  53. a = SetConf()
  54. a.section = "VenditaDettaglio"
  55. a.tipo_section ="Modulo"
  56. a.description = "Nome del movimento generato"
  57. a.tipo = "str"
  58. a.key = "operazione"
  59. a.value = "Scarico venduto da cassa"
  60. a.persist()
  61. a = SetConf()
  62. a.section = "VenditaDettaglio"
  63. a.tipo_section ="Modulo"
  64. a.description = "disabilita_stampa"
  65. a.tipo = "bool"
  66. a.key = "disabilita_stampa"
  67. a.value = "True"
  68. a.active = True
  69. a.persist()
  70. return
  71. if Environment.tipodb!="postgresql":
  72. print "PASSI QUI"
  73. pp = PanUi(main).draw()
  74. a = gtk.Label()
  75. a.set_text("OPZIONI MODULI")
  76. main.main_notebook.prepend_page(pp.pan_frame, a)
  77. main.main_notebook.set_current_page(0)
  78. text = "OPZIONE: <b>%s!</b>" %("ONE BASIC")
  79. main.pan_label_info.set_markup(text)
  80. return pp
  81. else:
  82. text = "OPZIONE: <b>%s</b>" %(Environment.tipo_pg)
  83. main.pan_label_info.set_markup(text)
  84. Environment.pg2log.info(text)
  85. # main.main_notebook.set_current_page(4)
  86. class PanUi(GladeWidget):
  87. """ Widget di configurazione del codice installazione e dei parametri
  88. di configurazione """
  89. def __init__(self, main):
  90. GladeWidget.__init__(self, 'pan_vbox',
  91. 'pan_dialog.glade')
  92. # self.placeWindow(self.getTopLevel())
  93. self.rowBackGround = None
  94. self.main = main
  95. def draw(self):
  96. return self
  97. def on_registrati_button_clicked(self, button):
  98. url ="http://www.promogest.me/userRegistration"
  99. webbrowser.open_new_tab(url)
  100. def on_one_main_button_clicked(self, button):
  101. url ="http://www.promogest.me/promoGest/preventivo_one"
  102. webbrowser.open_new_tab(url)
  103. def on_pro_main_button_clicked(self, button):
  104. url ="http://www.promogest.me/promoGest/preventivo_pro"
  105. webbrowser.open_new_tab(url)
  106. def on_promowear_main_button_clicked(self, button):
  107. url ="http://www.promogest.me/promoGest/preventivo_pro"
  108. webbrowser.open_new_tab(url)
  109. def on_promoshop_main_button_clicked(self, button):
  110. url ="http://www.promogest.me/promoGest/preventivo_pro"
  111. webbrowser.open_new_tab(url)
  112. def on_promowear_one_button_clicked(self, button):
  113. url ="http://www.promogest.me/promoGest/preventivo_one"
  114. webbrowser.open_new_tab(url)
  115. def on_promowear_pro_button_clicked(self, button):
  116. url ="http://www.promogest.me/promoGest/preventivo_pro"
  117. webbrowser.open_new_tab(url)
  118. def on_promoshop_one_button_clicked(self, button):
  119. url ="http://www.promogest.me/promoGest/preventivo_one"
  120. webbrowser.open_new_tab(url)
  121. def on_promoshop_pro_button_clicked(self, button):
  122. url ="http://www.promogest.me/promoGest/preventivo_pro"
  123. webbrowser.open_new_tab(url)
  124. def on_acquista_button_clicked(self, button):
  125. if self.main.pp.lite_radio.get_active():
  126. url ="http://www.promogest.me/promoGest/preventivo_lite"
  127. webbrowser.open_new_tab(url)
  128. elif self.main.pp.pro_radio.get_active():
  129. url ="http://www.promogest.me/promoGest/preventivo_pro"
  130. webbrowser.open_new_tab(url)
  131. elif self.main.pp.promowear_radio.get_active():
  132. messageInfo(msg="NON ancora disponibile")
  133. return
  134. url ="http://www.promogest.me/promoGest/preventivo_promowear"
  135. webbrowser.open_new_tab(url)
  136. elif self.main.pp.promoshop_radio.get_active():
  137. messageInfo(msg="NON ancora disponibile")
  138. return
  139. url ="http://www.promogest.met/promoGest/preventivo_promoshop"
  140. webbrowser.open_new_tab(url)