Re: os.popen encoding!

2009-02-18 Thread SMALLp
Thanks for help!

My problem was actualy:
>>> a = ["velja\xe8a 2009"]
>>> print a#will print
["velja\xe8a 2009"]
>>> Print a[0]#will print
veljaèa 2009

"Hrvoje Niksic"  wrote in message 
news:87ocwzzvym@mulj.homelinux.net...
> "Gabriel Genellina"  writes:
>
>>> I'm playing with os.popen function.
>>> a = os.popen("somecmd").read()
>>>
>>> If one of the lines contains characters like "e", "a"or any other it 
>>> loks
>>> line this "velja\xe8a 2009" with that "\xe8". It prints fine if i go:
>>>
>>> for i in a:
>>> print i:
>>
>> '\xe8' is a *single* byte (not four). It is the 'LATIN SMALL LETTER E
>> WITH  GRAVE' Unicode code point u'e' encoded in the Windows-1252
>> encoding (and  latin-1, and others too).
>
> Note that it is also 'LATIN SMALL LETTER C WITH CARON' (U+010D or
> u'è'), encoded in Windows-1250, which is what the OP is likely using.
>
> The rest of your message stands regardless: there is no problem, at
> least as long as the OP only prints out the character received from
> somecmd to something else that also expects Windows-1250.  The problem
> would arise if the OP wanted to store the string in a PyGTK label
> (which expects UTF8) or send it to a web browser (which expects
> explicit encoding, probably defaulting to UTF8), in which case he'd
> have to disambiguate whether '\xe8' refers to U+010D or to U+00E8 or
> something else entirely.
>
> That is the problem that Python 3 solves by requiring (or strongly
> suggesting) that such disambiguation be performed as early in the
> program as possible, preferrably while the characters are being read
> from the outside source.  A similar approach is possible using Python
> 2 and its unicode type, but since the OP never specified exactly which
> problem he had (except for the repr/str confusion), it's hard to tell
> if using the unicode type would help. 


--
http://mail.python.org/mailman/listinfo/python-list


os.popen encoding!

2009-02-18 Thread SMALLp
Hy.
I'm playing with os.popen function.
a = os.popen("somecmd").read()

If one of the lines contains characters like "è", "æ"or any other it loks 
line this "velja\xe8a 2009" with that "\xe8". It prints fine if i go:

for i in a:
print i:

How to solve this and where exectly is problem with print or read! Windows 
XP, Python 2.5.4

Thanks! 


--
http://mail.python.org/mailman/listinfo/python-list


Python, threading

2008-12-11 Thread SMALLp
Hy. I have a problem! I'm making multi thread application (client, 
server) using wxPython for GUI, and threading.Thread for threding.


Clients connect and when they are connected (evry thread handles one 
connection) threads change main window.


I neded tip how to make communication between threeds.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Transparent bitmap(image) in windows!

2008-04-05 Thread SMALLp
this is code that adds image:


kartaGif = wx.Image("slike/karta.gif", wx.BITMAP_TYPE_GIF)
kartaGif.Rescale(self.sizeX, self.sizeY)
kartaGif = wx.BitmapFromImage(kartaGif)
mask = wx.Mask(kartaGif, wx.WHITE)
kartaGif.SetMask(mask)
self.karta = wx.StaticBitmap(self.mPanel, -1, kartaGif, (10, 
10), 
(kartaGif.GetWidth(), kartaGif.GetHeight()))
self.karta.Bind(wx.EVT_LEFT_DOWN, self.getPos)  



SMALLp wrote:
> Hello everyone!
> 
> First I want to apologize for asking question about wxPython on this group.
> 
> I'm doing project that uses wx.ScrolledPanel few wx.Bitmap on it. It all 
> looks wonderful on Ubuntu and very very bad on windows because images 
> aren't transparent. As a found out it is problem that windows drowns 
> each image in separate window (or something like that)
> 
> I'm looking for best and easiest solution for this problem. I found 
> something to bind PAINT event to empty function but it doesn't work 
> because of scrolled panel.
> 
> Please help!
> 
> Thanks!
-- 
http://mail.python.org/mailman/listinfo/python-list


Transparent bitmap(image) in windows!

2008-04-05 Thread SMALLp
Hello everyone!

First I want to apologize for asking question about wxPython on this group.

I'm doing project that uses wx.ScrolledPanel few wx.Bitmap on it. It all 
looks wonderful on Ubuntu and very very bad on windows because images 
aren't transparent. As a found out it is problem that windows drowns 
each image in separate window (or something like that)

I'm looking for best and easiest solution for this problem. I found 
something to bind PAINT event to empty function but it doesn't work 
because of scrolled panel.

Please help!

Thanks!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Run Python app at startup

2008-03-04 Thread SMALLp
Gabriel Genellina wrote:
> En Sun, 02 Mar 2008 19:37:35 -0200, SMALLp <[EMAIL PROTECTED]> escribi�:
> 
>> Hy.
>> I create simple application. Yust an windows and "compile" it with
>> py2exe. I add registry  value
>> reg add 
>> HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v
>> MyApp /t REG_SZ /d C:\myapp.exe /f'
>>
>> And it wont start. When i use console instead od window in py2exe i get
>> console opend but it closes.
> 
> I'd check in this order:
> 
> python prog.py
> Then, use console=... in setup.py, generate prog.exe
> Open a cmd window and execute prog.exe (from the dist directory)
> Repeat using window=... in setup.py
> 
> That whole sequence works fine using on my WinXP SP2 + Python 2.5.1 + 
> wxPython 2.8.7.1
> 
Program works fine. When i run it it works. Problem is how to make this 
aplication start at windows startup. It opens and it closes in my case.
-- 
http://mail.python.org/mailman/listinfo/python-list

Run Python app at startup

2008-03-02 Thread SMALLp
Hy.
I create simple application. Yust an windows and "compile" it with
py2exe. I add registry  value
reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v
MyApp /t REG_SZ /d C:\myapp.exe /f'

And it wont start. When i use console instead od window in py2exe i get
console opend but it closes.

Program:

import os
import wx

app = wx.App()
frame = wx.Frame(None, -1, "MyFrame")
frame.Show()

app.MainLoop()


Then in commang prompt:

python.exe setup.py py2exe



from distutils.core import setup
import py2exe

setup(console=['prog.py'])


Help please!


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python app at startup!

2008-03-02 Thread SMALLp
Program:

import os
import wx

app = wx.App()
frame = wx.Frame(None, -1, "MyFrame")
frame.Show()

app.MainLoop()


python.exe setup.py py2exe

from distutils.core import setup
import py2exe

setup(windows=['prog.py'])


<[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> On Feb 29, 7:21 am, SMALLp <[EMAIL PROTECTED]> wrote:
>> [EMAIL PROTECTED] wrote:
>
>>
>> > Does it do the same thing when you run it with the Python interpreter?
>>
>> No. The programm works fine! In interupter and when i "compile" it.
>
> My guess is that you're not including something in the .exe that you
> need.  What does your py2exe command line and setup.py look like?
> 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python app at startup!

2008-02-29 Thread SMALLp
[EMAIL PROTECTED] wrote:
> On Feb 28, 5:07 pm, "SMALLp" <[EMAIL PROTECTED]> wrote:
>> Hy. I create simple application. Yust an windows and "compile" it with
>> py2exe. I add registry  value
>> reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v
>> MyApp /t REG_SZ /d C:\myapp.exe /f'
>>
>> And it wont start. When i use console instead od window in py2exe i get
>> console opend but it closes.
> 
> Does it do the same thing when you run it with the Python interpreter?
> 
No. The programm works fine! In interupter and when i "compile" it.
-- 
http://mail.python.org/mailman/listinfo/python-list


Python app at startup!

2008-02-28 Thread SMALLp
Hy. I create simple application. Yust an windows and "compile" it with 
py2exe. I add registry  value
reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v 
MyApp /t REG_SZ /d C:\myapp.exe /f'

And it wont start. When i use console instead od window in py2exe i get 
console opend but it closes.

Help please! 


-- 
http://mail.python.org/mailman/listinfo/python-list


Ignore exceptions

2008-01-24 Thread SMALLp
Hy. Is there any way to make interrupter ignore exceptions. I'm  working 
on bigger project and i used to put try catch blocks after writing and 
testing code what's boring and it's easy to make mistake. I remember of 
something like that in C++ but I cant find anythin like that for python.

SMALLp  
-- 
http://mail.python.org/mailman/listinfo/python-list


Python printing!

2008-01-23 Thread SMALLp
Hy. How to use printer in python. I goggled little i I found only some 
win32 package which doesn't look processing for cross platform 
application. (I'm using USB printer and I tried to f=open("dev/...") usb 
port but  i couldn't fond where printer is!

Tnx!

SMALLp
-- 
http://mail.python.org/mailman/listinfo/python-list


Downlod from FTP, pickle

2008-01-17 Thread SMALLp
Hy!

I have a little problem. I have to download file from FTP sp i use 
ftplib. And then i have to pickle.load from that file. I make callback 
function that saves line by line into temporary file and now i cant read 
from that file and when i close it i diapers.

Thanks!
-- 
http://mail.python.org/mailman/listinfo/python-list


py2exe command prompt whenr run

2008-01-03 Thread SMALLp
HY!

I'm using py2exe to port my applications on windows so user won't have 
to install python and other dependencies. Everything works file except 
when i run any of programs it star's command prompt before program starts.

How can i avoid this to happen, and is there any other way of porting my 
applications on windows?


Thanks!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python events, panel with text

2008-01-02 Thread SMALLp
SMALLp wrote:
> Hy!
> 
> I have many small panels with text and I want do bind wx.EVT_LEFT_DOWN 
> when clicked on panel, but i need to bind that in parent class. So I 
> have instance of that small panel and when i bind it efects only part of 
> small panel where is no text.
> 
> 
> 
> import wx
> 
> class RequestedFilesItems(wx.Panel):
> def __init__(self, parent, id):
> wx.Panel.__init__(self, parent, -1, style=wx.SUNKEN_BORDER)
> sizer = wx.BoxSizer(wx.HORIZONTAL)
>
> upButton = PanelButton(self, -1, "Upload")
> upButton.Bind(wx.EVT_LEFT_DOWN, self.upload)

i did smothing like this nad it works but id doesn't look so good:
upButton.text.Bind(wx.EVT_LEFT_DOWN, self.upload)

> sizer.Add(upButton, 0, wx.LEFT, 15)
> 
> 
> 
> self.SetSizer(sizer)   
> 
> def upload(self, event):
> print "Please print this"
> 
> 
>
> class PanelButton(wx.Panel):
> def __init__(self, parent, id, buttonName):
> wx.Panel.__init__(self, parent, -1, style=wx.SUNKEN_BORDER)
> self.SetBackgroundColour("GREY")
> sizer = wx.BoxSizer(wx.HORIZONTAL)
> self.text = wx.StaticText(self, -1, buttonName)   
> sizer.Add(self.text, -1, wx.EXPAND | wx.ALL, 1)
> self.text.Bind(wx.EVT_LEFT_DOWN, self.OnClick)
> self.SetSizer(sizer)
> 
> def OnClick(self, event):
> print "It only works for text, not for panel what I expected here"
> 
> 
> if __name__ == '__main__':
> app = wx.PySimpleApp()
> frm = wx.Frame(None, wx.ID_ANY, 'Mouse-click test')
> panel = RequestedFilesItems(frm, wx.ID_ANY)
> frm.Show()
> app.MainLoop()
> 
> 
> 
> app.MainLoop()
> 
> 
-- 
http://mail.python.org/mailman/listinfo/python-list


Bind mouse over event for panel (or Static text) wxPython

2008-01-02 Thread SMALLp
How to?

I couldn't find anything except EVT_ENTER_WINDOW that didn't work.
-- 
http://mail.python.org/mailman/listinfo/python-list


Python events, panel with text

2008-01-01 Thread SMALLp
Hy!

I have many small panels with text and I want do bind wx.EVT_LEFT_DOWN 
when clicked on panel, but i need to bind that in parent class. So I 
have instance of that small panel and when i bind it efects only part of 
small panel where is no text.



import wx

class RequestedFilesItems(wx.Panel):
def __init__(self, parent, id):
wx.Panel.__init__(self, parent, -1, style=wx.SUNKEN_BORDER)
sizer = wx.BoxSizer(wx.HORIZONTAL)

upButton = PanelButton(self, -1, "Upload")
upButton.Bind(wx.EVT_LEFT_DOWN, self.upload)
sizer.Add(upButton, 0, wx.LEFT, 15)



self.SetSizer(sizer)

def upload(self, event):
print "Please print this"



class PanelButton(wx.Panel):
def __init__(self, parent, id, buttonName):
wx.Panel.__init__(self, parent, -1, style=wx.SUNKEN_BORDER)
self.SetBackgroundColour("GREY")
sizer = wx.BoxSizer(wx.HORIZONTAL)
self.text = wx.StaticText(self, -1, buttonName) 
sizer.Add(self.text, -1, wx.EXPAND | wx.ALL, 1)
self.text.Bind(wx.EVT_LEFT_DOWN, self.OnClick)
self.SetSizer(sizer)

def OnClick(self, event):
print "It only works for text, not for panel what I expected 
here"


if __name__ == '__main__':
 app = wx.PySimpleApp()
 frm = wx.Frame(None, wx.ID_ANY, 'Mouse-click test')
 panel = RequestedFilesItems(frm, wx.ID_ANY)
 frm.Show()
 app.MainLoop()



app.MainLoop()


-- 
http://mail.python.org/mailman/listinfo/python-list


Compiler or stg. to get exe!

2007-12-28 Thread SMALLp
Hy!
I have question. After short goggling, I haven't found anything good. So 
my question is:
I wrote a program in python and i Get .py files and some .pyc in working 
folder. Now i want program tu run under windows, so i need to get exe 
files or something.
And what do i need to do to make program for linux. (stg. like .deb package)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: mysqldb SELECT COUNT reurns 1

2007-12-27 Thread SMALLp
Rob Williscroft wrote:
> SMALLp wrote in news:[EMAIL PROTECTED] in comp.lang.python:
> 
>> Hy! I nave another problem I can't solve!
>> 
>>
>>  import MySQLdb as mysql
> 
>> cursor = conn.cursor()
>> sql = "SELECT COUNT(*) FROM " + dataTable
>> res = cursor.execute(sql)
> 
> I think you need to do:
> res = cursor.fetchone()[0]
> 
> 
>> print res
>>
>> 
>> It prints 1, and there are 88 rows in table. SELECT works fine, but 
>> SELECT COUNT(*) makes problems.
>  
> Rob.
Of course! Thanks!
-- 
http://mail.python.org/mailman/listinfo/python-list


mysqldb SELECT COUNT reurns 1

2007-12-27 Thread SMALLp
Hy! I nave another problem I can't solve!


import MySQLdb as mysql

connectionString = {"host":"localhost", "user":"root", 
"passwd":"pofuck", "db":"fileshare"}
dataTable = "files"
conn = mysql.connect(host=connectionString["host"],
user=connectionString["user"], passwd=connectionString["passwd"],
db=connectionString["db"])  

cursor = conn.cursor()
sql = "SELECT COUNT(*) FROM " + dataTable
res = cursor.execute(sql)
print res


It prints 1, and there are 88 rows in table. SELECT works fine, but 
SELECT COUNT(*) makes problems.

Help! Thanks in advance!
-- 
http://mail.python.org/mailman/listinfo/python-list


Python mouse EVT_COMMAND_LEFT_CLICK, EVT_LEFT_DOWN

2007-12-27 Thread SMALLp
Hy!
I'm not able to tu bind mouse click event. Code:

class MouseClass(wx.Panel):
def __init__(self, parent, id):

wx.Panel.__init__(self, parent, id, size=(500, 300))
self.SetBackgroundColour("WHITE")

sizer = wx.BoxSizer(wx.VERTICAL)

testPanel.SetBackgroundColour("BLACK")
self.Bind(wx.EVT_COMMAND_LEFT_CLICK, self.open, 
id=testPanel.GetId())
sizer.Add(testPanel, 0, wx.EXPAND)
self.SetSizerAndFir(sizer)

def open(self, event):
print "yea"

U  tried EVT_LEFT_DOWN as I found on goofle and couldnt get it to work. 
Please help.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Beginner question!

2007-12-21 Thread SMALLp
Carsten Haese wrote:
> On Fri, 2007-12-21 at 18:06 +0100, SMALLp wrote:
>>>> sql ="INSERT INTO "+dataTable+" (user_name, file_name, 
>>>> file_size,
>>>> file_path_local, file_path_FTP, curent_location, FTP_valid_time,
>>>> uploaded, last_modified, last_verified, file_type, file_category) VLAUES
>>>> "+data
>>>> cursor.execute(sql)
> 
>> Thanks! I solved the problem. And I thing i understand now.
> 
> You may have solved your initial problem, but the above snippet raises
> two red flags:
> 
> 1) Why is the table name coming from a variable? This implies to me that
> you a working with a collection of tables with different names that all
> have the same column names. If that is the case, that smells of really
> bad database design. If at all possible, those tables should be merged
> into one table that has an additional column (or set of columns) for
> distinguishing which "fragment" each row is in.
> 
> 2) Sticking literal values into an SQL query string is a bad idea. You
> should learn about parametrized queries, e.g. here:
> http://informixdb.blogspot.com/2007/07/filling-in-blanks.html
> 
> Hope this helps,
> 
Good question. I'm using only one tale and have no idea why i had table 
name from variable. But every new knowledge comes handy.

One more question. How does my code looks like. I couldn't find any open 
source program written in python to learn from, so i read some tutorials 
and I'm not sure about how it looks.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Beginner question!

2007-12-21 Thread SMALLp
[EMAIL PROTECTED] wrote:
>> Traceback (most recent call last):
>>File "/home/pofuk/MzMFIleShare/sharePanel.py", line 130, in share
>>  self.scanDirsAndFiles(dirPath)
>>File "/home/pofuk/MzMFIleShare/sharePanel.py", line 158, in
>> scanDirsAndFiles
>>  sql.insertData.insert("files", data)
>> TypeError: unbound method insert() must be called with insertData
>> instance as first argument (got str instance instead)
>>
>> share.py
> 
> 
> 
> 
> 
>> def scanDirsAndFiles(self, dirPath):
>> for item in os.listdir(dirPath):
>> if os.path.isdir(os.path.join(dirPath, item)):
>> scanDirsAndFiles(os.path.join(dirPath, item))
>> if os.path.isfile(os.path.join(dirPath, item)):
>> user_name = login.getUserName()
>> fileName = item
>> fileSize = 
>> os.path.getsize(os.path.join(dirPath, item))
>> filePathLocal = os.path.join(dirPath, item)
>> filePathFTP = ""
>> currentLocation = "Local"
>> FTP_valid_time = 7
>> uploaded = ""
>> lastModified = "NOW()"
>> lastVerified = "NOW()"
>> fileType = "file"
>> fileCategory = "Ostalo"
>>
>> data = [fileName, fileSize, filePathLocal, 
>> filePathFTP,
>> currentLocation, FTP_valid_time, uploaded, lastModified, lastVerified,
>> fileType, fileCategory]
>>
>> sql.insertData.insert("files", data)
>>
> 
> 
> 
> 
> 
>> class insertData:
>> def insert(self, dataTable, data):
>> conn = self.openConnection.openConnection()
>> cursor = conn.cursor()
>> sql ="INSERT INTO "+dataTable+" (user_name, file_name, 
>> file_size,
>> file_path_local, file_path_FTP, curent_location, FTP_valid_time,
>> uploaded, last_modified, last_verified, file_type, file_category) VLAUES
>> "+data
>> cursor.execute(sql)
>> conn.Close()
> 
> It doesn't look like you are instantiating the insertData class. You
> would need to do something like:
> 
> # untested
> foo = insertData()
> foo.insert("files", data)
> 
> 
> But I agree with Chris. You really do need to go through a tutorial on
> using classes and following Python naming conventions. Dive Into
> Python and some of the other online resources are very helpful.
> 
> This is something that I have trouble with myself since wxPython uses
> CamelCase for classes and methods/functions and and most
> recommendations for plain Python seem to only want CamelCase for
> classes and something like myFunct or myMethod for the other objects.
> 
> Mike
Thanks! I solved the problem. And I thing i understand now.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Beginner question!

2007-12-21 Thread SMALLp
[EMAIL PROTECTED] wrote:
> On Dec 21, 9:11 am, SMALLp <[EMAIL PROTECTED]> wrote:
>> Hy! I have error something like this
>>
>> TypeError: unbound method insert() must be called with insertData
>> instance as first argument (got str instance instead)
>>
>> CODE:
>>
>> File1.py
>> sql.insertData.insert("files", data)
>>
>> sql.py
>>
>> class insertData:
>> def insert(self, dataTable, data):
>> conn = self.openConnection.openConnection()
>> cursor = conn.cursor()
>> sql ="INSERT INTO "+dataTable+" (user_name, file_name, 
>> file_size,
>> file_path_local, file_path_FTP, curent_location, FTP_valid_time,
>> uploaded, last_modified, last_verified, file_type, file_category) VLAUES
>> "+data
>> cursor.execute(sql)
>> conn.Close()
>>
>> Help and advice neaded!
> 
> I think you need to post the real traceback or the real code since
> your error message doesn't look like it has anything to do with the
> code above. At least, I do not see a method named "insert".
> 
> Which database module are you using?
> 
> Mike

Traceback (most recent call last):
   File "/home/pofuk/MzMFIleShare/sharePanel.py", line 130, in share
 self.scanDirsAndFiles(dirPath)
   File "/home/pofuk/MzMFIleShare/sharePanel.py", line 158, in 
scanDirsAndFiles
 sql.insertData.insert("files", data)
TypeError: unbound method insert() must be called with insertData 
instance as first argument (got str instance instead)



share.py

import wx
import os
import sql
import login
class sharePanel(wx.Panel):
def __init__(self, parent, id):
wx.Panel.__init__(self, parent, id)
sizer = wx.BoxSizer(wx.VERTICAL)

nb = wx.Notebook(self, -1,style=wx.NB_TOP)

self.sheet1 = p1(nb, id)
self.sheet2 = p2(nb, id)
self.sheet3 = p3(nb, id)

nb.AddPage(self.sheet1, 'SEt1')
nb.AddPage(self.sheet2, 'Sheet2')
nb.AddPage(self.sheet3, 'Sheet3')

self.sheet1.SetFocus()

sizer.Add(nb,0, wx.EXPAND | wx.TOP, 20)



self.SetSizerAndFit(sizer)  

class pageMenu(wx.Panel):
def __init__(self, parent, id):
wx.Panel.__init__(self, parent, id)
self.SetBackgroundColour("WHITE")

sizer = wx.BoxSizer(wx.HORIZONTAL)
self.links = wx.StaticText(self, -1, "<<<  1  2  3  4  5  6  7  
8  9 
10  >>>")
sizer.Add(self.links)

class p1(wx.Panel):
def __init__(self, parent, id):
wx.Panel.__init__(self, parent, id, size=(500, 300))
self.SetBackgroundColour("WHITE")

sizer = wx.BoxSizer(wx.VERTICAL)

self.pMenu = pageMenu(self, id)
sizer.Add(self.pMenu,0, wx.LEFT | wx.TOP | wx.RIGHT, 40)

fileList = myFilesList(self, id)
sizer.Add(fileList, 0, wx.LEFT | wx.RIGHT, 10)

shareBox = sharePanelBox(self, id)
sizer.Add(shareBox,0, wx.EXPAND | wx.TOP | wx.LEFT, 20)

sizer.Fit(self)
self.SetSizerAndFit(sizer)

class p2(wx.Panel):
def __init__(self, parent, id):
wx.Panel.__init__(self, parent, id, size=(200, 200))
self.SetBackgroundColour("RED")

class p3(wx.Panel):
def __init__(self, parent, id):
wx.Panel.__init__(self, parent, id, size=(200, 100))
self.SetBackgroundColour("YELLOW")


class myFilesList(wx.Panel):
def __init__(self, parent, id):
wx.Panel.__init__(self, parent, id)
self.SetBackgroundColour("WHITE")

vsizer = wx.BoxSizer(wx.VERTICAL)
data = {'fileName':'My filename', 
'filePath':'/home/pofuk/Documents/myfile', 'fileSize':'41223 MB'}


for i in range(10): 
d = [myFilesListItem(self, id, data)]
vsizer.Add(d[0],1,  wx.EXPAND)

self.SetSizerAndFit(vsizer)



class myFilesListItem(wx.Panel):
def __init__(self, parent, id, data):
wx.Panel.__init__(self, parent, id)
self.SetBackgroundColour("WHITE")   

hsizer = wx.BoxSizer

Beginner question!

2007-12-21 Thread SMALLp
Hy! I have error something like this

TypeError: unbound method insert() must be called with insertData 
instance as first argument (got str instance instead)

CODE:

File1.py
sql.insertData.insert("files", data)

sql.py

class insertData:
def insert(self, dataTable, data):
conn = self.openConnection.openConnection() 
cursor = conn.cursor()
sql ="INSERT INTO "+dataTable+" (user_name, file_name, 
file_size, 
file_path_local, file_path_FTP, curent_location, FTP_valid_time, 
uploaded, last_modified, last_verified, file_type, file_category) VLAUES 
"+data
cursor.execute(sql)
conn.Close()


Help and advice neaded!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: wxPython FileDialog, select folder

2007-12-20 Thread SMALLp
farsheed wrote:
> import wx
> def dirchoose():
>   'Gives the user selected path. Use: dirchoose()'
>   global _selectedDir , _userCancel   #you should define
> them before
>   userPath = 'c:/'
>   app = wx.App()
>   dialog = wx.DirDialog(None, "Please choose your project directory:",\
> style=1 ,defaultPath=userPath, pos = (10,10))
>   if dialog.ShowModal() == wx.ID_OK:
>   _selectedDir = dialog.GetPath()
>   return _selectedDir
>   else:
>   #app.Close()
>   dialog.Destroy()
>   return _userCancel
> 
> Cheers, Farsheed.
Thanks! I've already figured it out from first reply. Now i get selected 
directory and i want to get all directories from thin directory. I found 
os.listdir but it oly gets names of files and i nedd output with 
permisions e.g. -rw-r--r--  1 pofuk pofuk  105 2007-12-19 21:59 login.py
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: wxPython FileDialog, select folder

2007-12-20 Thread SMALLp
Chris Mellon wrote:
> On Dec 20, 2007 3:19 PM, SMALLp <[EMAIL PROTECTED]> wrote:
>> How can i select folder either with wx.FileDialog or with any other. I
>> managed to fine only how to open files but I need to select folder to
>> get files from all sub folders.
>>
> 
> 
> There's a separate dialog, wx.DirDialog.

Now I cant find where I've seen how to get directory listing with 
premissions (-rw-...and this).
-- 
http://mail.python.org/mailman/listinfo/python-list


wxPython FileDialog, select folder

2007-12-20 Thread SMALLp
How can i select folder either with wx.FileDialog or with any other. I 
managed to fine only how to open files but I need to select folder to 
get files from all sub folders.

Thanks in advance!

-- 
http://mail.python.org/mailman/listinfo/python-list


Allingn controls wxPython

2007-12-15 Thread SMALLp
Hy. I need help. I'm using BoxSizer and i put TextCtrl and StaticText 
next to each other and they gor alligned by top of TextCtrl and it looks 
terrible. How can i make thm to be alligned by center of each controll.

Thnaks!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python import search path!

2007-12-14 Thread SMALLp
[EMAIL PROTECTED] wrote:
> On Dec 14, 3:44 pm, SMALLp <[EMAIL PROTECTED]> wrote:
>> Hy!
>> I'm new in Linux, and i feel little less newer in python.
>>
>> I need advice and help. I'm making an application witch purpose is
>> irrelevant. It has a lot of code for now and I've only made interface.
>> So I've tried to split code into separate files and in windows as I
>> remember worked file when i wrote  eg. import myFile but now in Ubuntu
>> it says Module not found. (I'm using Ubuntu and I've installed python
>> 2.5 and wxPython 2.8.4, and I'm using GedIt as my favorite text editor).
>> The question is how to make this work (files are in the same folder)
>>
> 
> Not sure what is going on here from this description. You may need to
> use the sys module and add the path to your module temporarily.
> 
> import sys
> sys.path.append("//path/to/myFile")
> 
> 


I managed to make simple thing complicated. So what i was trying to do 
is to write part of my program in a separate file and than use "import 
myFile as my" to use classes written in that file.

Thanks for the answer Mike!
-- 
http://mail.python.org/mailman/listinfo/python-list


Python import search path!

2007-12-14 Thread SMALLp
Hy!
I'm new in Linux, and i feel little less newer in python.

I need advice and help. I'm making an application witch purpose is 
irrelevant. It has a lot of code for now and I've only made interface. 
So I've tried to split code into separate files and in windows as I 
remember worked file when i wrote  eg. import myFile but now in Ubuntu 
it says Module not found. (I'm using Ubuntu and I've installed python 
2.5 and wxPython 2.8.4, and I'm using GedIt as my favorite text editor). 
The question is how to make this work (files are in the same folder)

Second question is about import wx. When i separate code into files i 
have to write import wx into every file because all of them contains 
some part of the interface. Does that make my program bigger than 
putting everything into one file and use only one import.

Thanks in advance.
-- 
http://mail.python.org/mailman/listinfo/python-list


Pascal code checker!

2007-12-12 Thread SMALLp
Hy! I desperately need help!

I need to make application that would accept Pascal code and check if it 
returns good results.

My idea is (from a beginner point of view) to make application in python 
that would send code (text) to pascal compiler (Free pascal compiler 
that can be used from command prompt in windows) and it would return 
result and then application would show that result.

Problem starts Here. I have no idea what to search for and where to even 
start. So what i need is some help (better say ideas) what to search and 
what to do. Please help, I have a lot of time and will to learn. I only 
need to know what.

Thanks in advance!
-- 
http://mail.python.org/mailman/listinfo/python-list


Witch editor to use!

2007-11-30 Thread SMALLp
Hello!

I'm new in wxPython and before i start doing anything I have one qustion.

Shoul I use some of editors like boa, spe or shoud i use my favorite 
text editor!

i used IDLE on windows and it seamd nice. Now i have linux installed on 
my mashine and boa works, spe wont start, IDLE crashes when compailinfg!

And if editor is bether choice witch one to use!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: wxPython problem

2007-11-28 Thread SMALLp
SMALLp wrote:
> [EMAIL PROTECTED] wrote:
>> On Nov 28, 1:06 pm, SMALLp <[EMAIL PROTECTED]> wrote:
>>> Hy. I'm new in linux (Ubuntu 7.10) as well as in python. I installed
>>> IDLE, and i installed package python-wxgtkX. I start IDLE and when i
>>> want co compile my aplication all windows close. Also when i vrite
>>> smoethin lik thile in IDLE:
>>>
>>> import wx
>>> app = wx.App()
>>> wx.Frmae(none, -1)
>>>
>>> same thing, Please help! Thanks!
>>
>> I'm not sure, but I don't think you downloaded the package correctly.
>> Go here for complete instructions:
>>
>> http://wxpython.org/download.php
>>
>> I think you need to replace the "X" in "python-wxgtkX" with the
>> release number. Something like "python-wxgtk2.8" or some such.
>>
>> Then try to import wx and see if that works.
>>
>> If none of that works, post to the wxPython user's group which can be
>> found at the link above.
>>
>> Mike
> Ups. i installed python-wxgtk2.8 package!

I'm still having the problem! i installed new version of wxPyton, and 
now I'v noticed that when i'm writing in IDLE
app = wx.App()
frame = wx.Frame(None, -1, 'My frame') it crashes when writing last 
bracket. It works
with PyShell so if no one can halp sugest goot alternative to IDLE.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: wxPython problem

2007-11-28 Thread SMALLp
[EMAIL PROTECTED] wrote:
> On Nov 28, 1:06 pm, SMALLp <[EMAIL PROTECTED]> wrote:
>> Hy. I'm new in linux (Ubuntu 7.10) as well as in python. I installed
>> IDLE, and i installed package python-wxgtkX. I start IDLE and when i
>> want co compile my aplication all windows close. Also when i vrite
>> smoethin lik thile in IDLE:
>>
>> import wx
>> app = wx.App()
>> wx.Frmae(none, -1)
>>
>> same thing, Please help! Thanks!
> 
> I'm not sure, but I don't think you downloaded the package correctly.
> Go here for complete instructions:
> 
> http://wxpython.org/download.php
> 
> I think you need to replace the "X" in "python-wxgtkX" with the
> release number. Something like "python-wxgtk2.8" or some such.
> 
> Then try to import wx and see if that works.
> 
> If none of that works, post to the wxPython user's group which can be
> found at the link above.
> 
> Mike
Ups. i installed python-wxgtk2.8 package!
-- 
http://mail.python.org/mailman/listinfo/python-list


wxPython problem

2007-11-28 Thread SMALLp
Hy. I'm new in linux (Ubuntu 7.10) as well as in python. I installed 
IDLE, and i installed package python-wxgtkX. I start IDLE and when i 
want co compile my aplication all windows close. Also when i vrite 
smoethin lik thile in IDLE:

import wx
app = wx.App()
wx.Frmae(none, -1)

same thing, Please help! Thanks!
-- 
http://mail.python.org/mailman/listinfo/python-list


Python beginner!

2007-11-15 Thread SMALLp
Could someone please paste some program in wxPython that uses inharitance. I 
would be very thankfull.



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help needed!

2007-11-12 Thread SMALLp
I forgot, I'm using wxPython
"SMALLp" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> I'm new in python and i got lost.
>
> Ima building an aplication that add's 2 panels and menu bar to the window. 
> So i made base class that makes window, menuBarClass that inherits 
> mainWindowClass.
>
> Problem is with PanelClass that would need to inherit MainWindowClass to 
> add panels. So if someone has time to write simple example it would be 
> realy helpfull.
>
>
>
> 


-- 
http://mail.python.org/mailman/listinfo/python-list


Help needed!

2007-11-12 Thread SMALLp
I'm new in python and i got lost.

Ima building an aplication that add's 2 panels and menu bar to the window. 
So i made base class that makes window, menuBarClass that inherits 
mainWindowClass.

Problem is with PanelClass that would need to inherit MainWindowClass to add 
panels. So if someone has time to write simple example it would be realy 
helpfull.

 


-- 
http://mail.python.org/mailman/listinfo/python-list