Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Weblate
gajim
Commits
c887a92b
Commit
c887a92b
authored
15 years ago
by
Yann Leboulanger
Browse files
Options
Downloads
Patches
Plain Diff
rename some variables to remove some pylint warning
parent
fcada2f9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/gajim.py
+28
-35
28 additions, 35 deletions
src/gajim.py
with
28 additions
and
35 deletions
src/gajim.py
+
28
−
35
View file @
c887a92b
...
...
@@ -70,15 +70,15 @@ import getopt
from
common
import
i18n
def
parseOpts
():
profile
=
''
config_path
=
None
profile
_
=
''
config_path
_
=
None
try
:
shortargs
=
'
hqvl:p:c:
'
longargs
=
'
help quiet verbose loglevel= profile= config_path=
'
opts
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
shortargs
,
longargs
.
split
())[
0
]
except
getopt
.
error
,
msg
:
print
msg
except
getopt
.
error
,
msg
1
:
print
msg
1
print
'
for help use --help
'
sys
.
exit
(
2
)
for
o
,
a
in
opts
:
...
...
@@ -92,12 +92,12 @@ def parseOpts():
elif
o
in
(
'
-v
'
,
'
--verbose
'
):
logging_helpers
.
set_verbose
()
elif
o
in
(
'
-p
'
,
'
--profile
'
):
# gajim --profile name
profile
=
a
profile
_
=
a
elif
o
in
(
'
-l
'
,
'
--loglevel
'
):
logging_helpers
.
set_loglevels
(
a
)
elif
o
in
(
'
-c
'
,
'
--config-path
'
):
config_path
=
a
return
profile
,
config_path
config_path
_
=
a
return
profile
_
,
config_path
_
profile
,
config_path
=
parseOpts
()
del
parseOpts
...
...
@@ -136,11 +136,11 @@ if os.name == 'nt':
warnings
.
filterwarnings
(
'
error
'
,
module
=
'
gtk
'
)
try
:
import
gtk
except
Warning
,
msg
:
if
str
(
msg
)
==
'
could not open display
'
:
except
Warning
,
msg
2
:
if
str
(
msg
2
)
==
'
could not open display
'
:
print
>>
sys
.
stderr
,
_
(
'
Gajim needs X server to run. Quiting...
'
)
else
:
print
>>
sys
.
stderr
,
_
(
'
importing PyGTK failed: %s
'
)
%
str
(
msg
)
print
>>
sys
.
stderr
,
_
(
'
importing PyGTK failed: %s
'
)
%
str
(
msg
2
)
sys
.
exit
()
warnings
.
resetwarnings
()
...
...
@@ -268,7 +268,7 @@ def pid_alive():
(
'
szExeFile
'
,
c_char
*
512
,
),
]
def
__init__
(
self
):
Structure
.
__init__
(
self
,
512
+
9
*
4
)
super
(
PROCESSENTRY32
,
self
)
.
__init__
(
self
,
512
+
9
*
4
)
k
=
windll
.
kernel32
k
.
CreateToolhelp32Snapshot
.
argtypes
=
c_ulong
,
c_ulong
,
...
...
@@ -278,15 +278,15 @@ def pid_alive():
k
.
Process32Next
.
argtypes
=
c_int
,
POINTER
(
PROCESSENTRY32
),
k
.
Process32Next
.
restype
=
c_int
def
get_p
(
p
):
def
get_p
(
p
id_
):
h
=
k
.
CreateToolhelp32Snapshot
(
2
,
0
)
# TH32CS_SNAPPROCESS
assert
h
>
0
,
'
CreateToolhelp32Snapshot failed
'
b
=
pointer
(
PROCESSENTRY32
())
f
=
k
.
Process32First
(
h
,
b
)
while
f
:
if
b
.
contents
.
th32ProcessID
==
p
:
f
3
=
k
.
Process32First
(
h
,
b
)
while
f
3
:
if
b
.
contents
.
th32ProcessID
==
p
id_
:
return
b
.
contents
.
szExeFile
f
=
k
.
Process32Next
(
h
,
b
)
f
3
=
k
.
Process32Next
(
h
,
b
)
if
get_p
(
pid
)
in
(
'
python.exe
'
,
'
gajim.exe
'
):
return
True
...
...
@@ -296,14 +296,14 @@ def pid_alive():
return
True
# no /proc, assume Gajim is running
try
:
f
=
open
(
'
/proc/%d/cmdline
'
%
pid
)
except
IOError
,
e
:
if
e
.
errno
==
errno
.
ENOENT
:
f
1
=
open
(
'
/proc/%d/cmdline
'
%
pid
)
except
IOError
,
e
1
:
if
e
1
.
errno
==
errno
.
ENOENT
:
return
False
# file/pid does not exist
raise
n
=
f
.
read
().
lower
()
f
.
close
()
n
=
f
1
.
read
().
lower
()
f
1
.
close
()
if
n
.
find
(
'
gajim
'
)
<
0
:
return
False
return
True
# Running Gajim found at pid
...
...
@@ -338,16 +338,15 @@ if not os.path.exists(pid_dir):
check_paths
.
create_path
(
pid_dir
)
# Create pid file
try
:
f
=
open
(
pid_filename
,
'
w
'
)
f
.
write
(
str
(
os
.
getpid
()))
f
.
close
()
except
IOError
,
e
:
dlg
=
dialogs
.
ErrorDialog
(
_
(
'
Disk Write Error
'
),
str
(
e
))
f
2
=
open
(
pid_filename
,
'
w
'
)
f
2
.
write
(
str
(
os
.
getpid
()))
f
2
.
close
()
except
IOError
,
e
2
:
dlg
=
dialogs
.
ErrorDialog
(
_
(
'
Disk Write Error
'
),
str
(
e
2
))
dlg
.
run
()
dlg
.
destroy
()
sys
.
exit
()
del
pid_dir
del
f
def
on_exit
():
# delete pid file on normal exit
...
...
@@ -379,7 +378,7 @@ if __name__ == '__main__':
except
ImportError
:
pass
else
:
def
die_cb
(
cli
):
def
die_cb
(
dummy
):
gajim
.
interface
.
roster
.
quit_gtkgui_interface
()
gnome
.
program_init
(
'
gajim
'
,
gajim
.
version
)
cli
=
gnome
.
ui
.
master_client
()
...
...
@@ -390,13 +389,7 @@ if __name__ == '__main__':
if
path_to_gajim_script
:
argv
=
[
path_to_gajim_script
]
# FIXME: remove this typeerror catch when gnome python is old
# and not bad patched by distro men [2.12.0 + should not need
# all that NORMALLY]
try
:
cli
.
set_restart_command
(
argv
)
except
AttributeError
:
cli
.
set_restart_command
(
len
(
argv
),
argv
)
cli
.
set_restart_command
(
len
(
argv
),
argv
)
check_paths
.
check_and_possibly_create_paths
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment